class RlpxAgent {

  public Optional<CompletableFuture<PeerConnection>> getPeerConnection(final Peer peer) {
    final RlpxConnection connection = connectionsById.get(peer.getId());
    return Optional.ofNullable(connection)
        .filter(conn -> !conn.isFailedOrDisconnected())
        .map(RlpxConnection::getFuture);
  }

  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);

}