private void handlePermissionsUpdate(
      final boolean permissionsRestricted, final Optional<List<Peer>> peers) {
    if (!permissionsRestricted) {
      // Nothing to do
      return;
    }

    final Stream<PeerConnection> connectionsToCheck;
    if (peers.isPresent()) {
      final List<Bytes> changedPeersIds =
          peers.get().stream().map(p -> p.getId()).collect(Collectors.toList());
      connectionsToCheck =
          streamConnections().filter(c -> changedPeersIds.contains(c.getPeer().getId()));
    } else {
      connectionsToCheck = streamConnections();
    }

    connectionsToCheck.forEach(
        connection -> {
          if (!peerPermissions.allowOngoingConnection(
              connection.getPeer(), connection.inboundInitiated())) {
            LOG.debug(
                "Disconnecting from peer that is not permitted to maintain ongoing connection: {}",
                connection);
            connection.disconnect(DisconnectReason.REQUESTED);
          }
        });
  }
Connect to the peer

@param peer The peer to connect to
@return A future that will resolve to the existing or newly-established connection with this
    peer.
ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/rlpx/RlpxAgent.java