@Test
  public void completesWhenBestPeerTimeoutsAndSecondPeerIsResponsive()
      throws ExecutionException, InterruptedException {
    // Setup first unresponsive peer
    final RespondingEthPeer firstPeer =
        EthProtocolManagerTestUtil.createPeer(ethProtocolManager, 10);

    // Setup second responsive peer
    final RespondingEthPeer secondPeer =
        EthProtocolManagerTestUtil.createPeer(ethProtocolManager, 9);

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

    // First peer timeouts
    peerCountToTimeout.set(1);
    firstPeer.respondTimes(
        RespondingEthPeer.blockchainResponder(
            blockchain, protocolContext.getWorldStateArchive(), transactionPool),
        2);
    // Second peer is responsive
    secondPeer.respondTimes(
        RespondingEthPeer.blockchainResponder(
            blockchain, protocolContext.getWorldStateArchive(), transactionPool),
        2);

    responsivePeer = Optional.of(secondPeer.getEthPeer());

    assertThat(future.isDone()).isTrue();
    assertResultMatchesExpectation(requestedData, future.get(), secondPeer.getEthPeer());
  }
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