Search in sources :

Example 1 with TrackedNetworkConnection

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());
}
Also used : TrackedNetworkConnection(org.neo4j.kernel.api.net.TrackedNetworkConnection) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) NetworkConnectionTracker(org.neo4j.kernel.api.net.NetworkConnectionTracker) Test(org.junit.jupiter.api.Test)

Aggregations

EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)1 Test (org.junit.jupiter.api.Test)1 NetworkConnectionTracker (org.neo4j.kernel.api.net.NetworkConnectionTracker)1 TrackedNetworkConnection (org.neo4j.kernel.api.net.TrackedNetworkConnection)1