@Override protected void channelIdle(ChannelHandlerContext ctx, IdleStateEvent evt) throws Exception { if (alreadyTriggeredException) { runnableWithTracingAndMdc( () -> logger.error( "IncompleteHttpCallTimeoutHandler triggered multiple times - this should not happen." ), ctx ).run(); return; } channelIdleTriggered(ctx, evt); alreadyTriggeredException = true; throw new IncompleteHttpCallTimeoutException(idleTimeoutMillis); }
@Override protected void channelIdle(ChannelHandlerContext ctx, IdleStateEvent evt) throws Exception { if (alreadyTriggeredException) { runnableWithTracingAndMdc( () -> logger.error( "IncompleteHttpCallTimeoutHandler triggered multiple times - this should not happen." ), ctx ).run(); return; } channelIdleTriggered(ctx, evt); alreadyTriggeredException = true; throw new IncompleteHttpCallTimeoutException(idleTimeoutMillis); }
@Test public void should_handle_IncompleteHttpCallTimeoutException() { verifyExceptionHandled(new IncompleteHttpCallTimeoutException(4242), singletonError( new ApiErrorWithMetadata(testProjectApiErrors.getMalformedRequestApiError(), Pair.of("cause", "Unfinished/invalid HTTP request")) )); }