use of org.neo4j.kernel.api.net.NetworkConnectionTracker 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());
}
use of org.neo4j.kernel.api.net.NetworkConnectionTracker in project neo4j by neo4j.
the class BuiltInDbmsProcedures method listConnections.
@SystemProcedure
@Description("List all accepted network connections at this instance that are visible to the user.")
@Procedure(name = "dbms.listConnections", mode = DBMS)
public Stream<ListConnectionResult> listConnections() {
NetworkConnectionTracker connectionTracker = getConnectionTracker();
ZoneId timeZone = getConfiguredTimeZone();
return connectionTracker.activeConnections().stream().filter(connection -> isAdminOrSelf(connection.username())).map(connection -> new ListConnectionResult(connection, timeZone));
}
Aggregations