@SuppressWarnings("StringConcatenationInsideStringBufferAppend")
  public void assertPeerConnections() {
    int errCnt = 0;
    final StringBuilder sb = new StringBuilder();
    Collection<TestNode> incorrectConnections;

    for (final TestNode node1 : nodes) {
      incorrectConnections = findMissingConnections(node1);
      for (final TestNode missingConnection : incorrectConnections) {
        sb.append(
            "Node "
                + node1.shortId()
                + " is missing connection to node "
                + missingConnection.shortId()
                + ".\n");
        errCnt++;
      }

      incorrectConnections = findExtraConnections(node1);
      for (final TestNode extraConnection : incorrectConnections) {
        sb.append(
            "Node "
                + node1.shortId()
                + " has unexpected connection to node "
                + extraConnection.shortId()
                + ".\n");
        errCnt++;
      }
    }
    final String header = "There are " + errCnt + " incorrect peer connections.\n";
    assertThat(errCnt).describedAs(header + sb).isEqualTo(0);
  }
Assert that all Nodes have exactly 1 connection to each other node
ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TestNodeList.java