### Question:
RlpxAgent { public void disconnect(final Bytes peerId, final DisconnectReason reason) { RlpxConnection connection = connectionsById.remove(peerId); if (connection != null) { connection.disconnect(reason); } } private  RlpxAgent(
      final LocalNode localNode,
      final PeerConnectionEvents connectionEvents,
      final ConnectionInitializer connectionInitializer,
      final PeerRlpxPermissions peerPermissions,
      final PeerPrivileges peerPrivileges,
      final int maxConnections,
      final int maxRemotelyInitiatedConnections,
      final MetricsSystem metricsSystem); static Builder builder(); CompletableFuture<Integer> start(); CompletableFuture<Void> stop(); Stream<? extends PeerConnection> streamConnections(); int getConnectionCount(); void connect(final Stream<? extends Peer> peerStream); void disconnect(final Bytes peerId, final DisconnectReason reason); Optional<CompletableFuture<PeerConnection>> getPeerConnection(final Peer peer); CompletableFuture<PeerConnection> connect(final Peer peer); void subscribeMessage(final Capability capability, final MessageCallback callback); void subscribeConnect(final ConnectCallback callback); void subscribeDisconnect(final DisconnectCallback callback);  }### Answer:
@Test public void disconnect() throws ExecutionException, InterruptedException { startAgent(); final Peer peer = spy(createPeer()); final CompletableFuture<PeerConnection> future = agent.connect(peer); final MockPeerConnection connection = (MockPeerConnection) future.get(); assertThat(agent.getConnectionCount()).isEqualTo(1); assertThat(agent.getPeerConnection(peer)).isNotEmpty(); final DisconnectReason reason = DisconnectReason.REQUESTED; agent.disconnect(peer.getId(), reason); assertThat(agent.getConnectionCount()).isEqualTo(0); assertThat(connection.isDisconnected()).isTrue(); assertThat(connection.getDisconnectReason()).contains(reason); assertPeerConnectionNotTracked(peer); agent.disconnect(peer.getId(), reason); agent.disconnect(peer.getId(), reason); assertThat(agent.getConnectionCount()).isEqualTo(0); }