@Test
  public void disconnectAPeerWhenAllPeersTried() {
    maxRetries = MAX_PEERS + 1;
    final int numPeers = MAX_PEERS;
    final List<RespondingEthPeer> respondingPeers = new ArrayList<>(numPeers);
    for (int i = 0; i < numPeers; i++) {
      respondingPeers.add(EthProtocolManagerTestUtil.createPeer(ethProtocolManager, numPeers - i));
    }

    // Execute task and wait for response
    final T requestedData = generateDataToBeRequested();
    final EthTask<T> task = createTask(requestedData);
    task.run();

    respondingPeers.forEach(
        respondingPeer ->
            respondingPeer.respondWhile(
                RespondingEthPeer.emptyResponder(), respondingPeer::hasOutstandingRequests));

    assertThat(respondingPeers.get(numPeers - 1).getEthPeer().isDisconnected()).isTrue();
  }
Tests ethTasks that request data from the network, and retry until all of the data is received.

@param <T> The type of data being requested from the network
ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/ethtaskutils/RetryingSwitchingPeerMessageTaskTest.java