@Test
  public void failsWhenPeerReturnsPartialResultThenStops() {
    // Setup data to be requested and expected response

    // Setup a partially responsive peer and a non-responsive peer
    final RespondingEthPeer.Responder partialResponder =
        RespondingEthPeer.partialResponder(
            blockchain,
            protocolContext.getWorldStateArchive(),
            transactionPool,
            protocolSchedule,
            0.5f);
    final RespondingEthPeer.Responder emptyResponder = RespondingEthPeer.emptyResponder();
    final RespondingEthPeer respondingPeer =
        EthProtocolManagerTestUtil.createPeer(ethProtocolManager);

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

    // Respond once with no data
    respondingPeer.respond(emptyResponder);
    assertThat(future.isDone()).isFalse();

    // Respond once with partial data, this should reset failures
    respondingPeer.respond(partialResponder);
    assertThat(future.isDone()).isFalse();

    // Respond max times - 1 with no data
    respondingPeer.respondTimes(emptyResponder, maxRetries - 1);
    assertThat(future).isNotDone();

    // Next retry should fail
    respondingPeer.respond(emptyResponder);
    assertThat(future).isDone();
    assertThat(future.isCompletedExceptionally()).isTrue();
    assertThatThrownBy(future::get).hasCauseInstanceOf(MaxRetriesReachedException.class);
  }
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/RetryingMessageTaskTest.java