public MockPeerDiscoveryAgent build() {
      final int port = bindPort.orElseGet(nextAvailablePort::incrementAndGet);
      final DiscoveryConfiguration config = new DiscoveryConfiguration();
      final NatService natService = new NatService(Optional.empty());
      config.setBootnodes(bootnodes);
      config.setAdvertisedHost(advertisedHost);
      config.setBindPort(port);
      config.setEnabled(enabled);
      config.setFilterOnEnrForkId(false);

      final ForkIdManager mockForkIdManager = mock(ForkIdManager.class);
      final ForkId forkId = new ForkId(Bytes.EMPTY, Bytes.EMPTY);
      when(mockForkIdManager.getForkIdForChainHead()).thenReturn(forkId);
      when(mockForkIdManager.peerCheck(forkId)).thenReturn(true);
      final RlpxAgent rlpxAgent = mock(RlpxAgent.class);
      when(rlpxAgent.connect(any()))
          .thenReturn(CompletableFuture.failedFuture(new RuntimeException()));
      final MockPeerDiscoveryAgent mockPeerDiscoveryAgent =
          new MockPeerDiscoveryAgent(
              nodeKey, config, peerPermissions, agents, natService, mockForkIdManager, rlpxAgent);
      mockPeerDiscoveryAgent.getAdvertisedPeer().ifPresent(peer -> peer.setNodeRecord(nodeRecord));

      return mockPeerDiscoveryAgent;
    }
Start a single discovery agent with the provided bootstrap peers.

@param bootstrapPeers the list of bootstrap peers
@param peerPermissions peer permissions
@return a list of discovery agents.
ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/PeerDiscoveryTestHelper.java