### Question:
HouseKeeper extends ChannelInboundHandlerAdapter { @Override public void exceptionCaught( ChannelHandlerContext ctx, Throwable cause ) { if ( failed || isShuttingDown( ctx ) ) { return; } failed = true; try { if ( Exceptions.contains( cause, e -> e.getMessage().contains( "Connection reset by peer" ) ) ) { log.warn( "Fatal error occurred when handling a client connection, " + "remote peer unexpectedly closed connection: %s", ctx.channel() ); } else { log.error( "Fatal error occurred when handling a client connection: " + ctx.channel(), cause ); } } finally { ctx.close(); } } HouseKeeper( BoltConnection connection, Log log ); @Override void channelInactive( ChannelHandlerContext ctx ); @Override void exceptionCaught( ChannelHandlerContext ctx, Throwable cause );  }### Answer:
@Test public void shouldNotPropagateExceptionCaught() throws Exception { ChannelInboundHandler next = mock( ChannelInboundHandler.class ); BoltConnection connection = mock( BoltConnection.class ); channel = new EmbeddedChannel( new HouseKeeper( connection, NullLog.getInstance() ), next ); channel.pipeline().fireExceptionCaught( new RuntimeException( "some exception" ) ); verify( next, never() ).exceptionCaught( any(), any() ); }
@Test public void shouldNotLogConnectionResetErrors() throws Exception { AssertableLogProvider logProvider = new AssertableLogProvider(); HouseKeeper keeper = new HouseKeeper( null, logProvider.getLog( HouseKeeper.class ) ); Channel channel = mock( Channel.class ); when( channel.toString() ).thenReturn( "[some channel info]" ); ChannelHandlerContext ctx = mock( ChannelHandlerContext.class ); when( ctx.channel() ).thenReturn( channel ); when( ctx.executor() ).thenReturn( mock( EventExecutor.class ) ); IOException connResetError = new IOException( "Connection reset by peer" ); keeper.exceptionCaught( ctx, connResetError ); logProvider.assertExactly( AssertableLogProvider.inLog( HouseKeeper.class ).warn( "Fatal error occurred when handling a client connection, " + "remote peer unexpectedly closed connection: %s", channel ) ); }