NettyChannelTracker implements ChannelPoolHandler { @Override public void channelCreated( Channel channel ) { throw new IllegalStateException( "Untraceable channel created." ); } 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 shouldAddChannelToGroupWhenChannelCreated() { Channel channel = newChannel(); Channel anotherChannel = newChannel(); ChannelGroup group = mock( ChannelGroup.class ); NettyChannelTracker tracker = new NettyChannelTracker( DEV_NULL_METRICS, group, DEV_NULL_LOGGING ); tracker.channelCreated( channel, null ); tracker.channelCreated( anotherChannel, null ); verify( group ).add( channel ); verify( group ).add( anotherChannel ); }