use of org.neo4j.kernel.api.net.TrackedNetworkConnection in project neo4j by neo4j.
the class SocketTransportTest method shouldManageChannelsInChannelInitializer.
@Test
void shouldManageChannelsInChannelInitializer() {
NetworkConnectionTracker connectionTracker = mock(NetworkConnectionTracker.class);
SocketTransport socketTransport = newSocketTransport(connectionTracker, NO_THROTTLE);
EmbeddedChannel channel = new EmbeddedChannel(socketTransport.channelInitializer());
ArgumentCaptor<TrackedNetworkConnection> captor = ArgumentCaptor.forClass(TrackedNetworkConnection.class);
verify(connectionTracker).add(captor.capture());
verify(connectionTracker, never()).remove(any());
channel.close();
verify(connectionTracker).remove(captor.getValue());
}
Aggregations