NettyChannelTracker implements ChannelPoolHandler { @Override public void channelReleased( Channel channel ) { doInWriteLock( () -> { decrementInUse( channel ); incrementIdle( channel ); } ); channel.closeFuture().addListener( closeListener ); log.debug( "Channel [0x%s] released back to the pool", channel.id() ); } NettyChannelTracker( MetricsListener metricsListener, EventExecutor eventExecutor, Logging logging );  NettyChannelTracker( MetricsListener metricsListener, ChannelGroup channels, Logging logging ); @Override void channelReleased( Channel channel ); @Override void channelAcquired( Channel channel ); @Override void channelCreated( Channel channel ); void channelCreated( Channel channel, ListenerEvent creatingEvent ); ListenerEvent channelCreating( String poolId ); void channelFailedToCreate( String poolId ); void channelClosed( Channel channel ); int inUseChannelCount( BoltServerAddress address ); int idleChannelCount( BoltServerAddress address ); void prepareToCloseChannels();  }
@Test void shouldThrowWhenDecrementingForUnknownAddress() { Channel channel = newChannel(); assertThrows( IllegalStateException.class, () -> tracker.channelReleased( channel ) ); }