private PeerConnection connect(final Peer source, final Peer target) {
    synchronized (this) {
      final MockNetwork.MockPeerConnection establishedConnection =
          new MockNetwork.MockPeerConnection(source, target, this);
      final MockP2PNetwork sourceNode = nodes.get(source);
      final MockP2PNetwork targetNode = nodes.get(target);
      sourceNode.connections.put(target, establishedConnection);
      final MockNetwork.MockPeerConnection backChannel =
          new MockNetwork.MockPeerConnection(target, source, this);
      targetNode.connections.put(source, backChannel);
      sourceNode.connectCallbacks.forEach(c -> c.onConnect(establishedConnection));
      targetNode.connectCallbacks.forEach(c -> c.onConnect(backChannel));
      return establishedConnection;
    }
  }
Get the {@link P2PNetwork} that assumes a given {@link Peer} as the local node. This does not
connect {@link Peer} to any other peer. Any connections established by {@link #connect(Peer,
Peer)} require that both participating {@link Peer} have previously been passed to this method.

@param peer Peer to get {@link P2PNetwork} for
@return P2PNetwork as seen by {@link Peer}
ethereum/mock-p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/testing/MockNetwork.java