@Test
  public void testNetworkRequestDynamicTimeoutAllFailure() throws Exception {
    doPut();
    GetBlobOperation op = createOperation(routerConfig, null);
    op.poll(requestRegistrationCallback);
    int count = 0;
    int deltaTimeOut = routerConfig.routerRequestNetworkTimeoutMs / 10;
    while (!op.isOperationComplete()) {
      int numRequestsToDrop = 0;
      for (RequestInfo requestInfo : requestRegistrationCallback.getRequestsToSend()) {
        requestInfo.setRequestEnqueueTime(time.milliseconds());
        numRequestsToDrop++;
      }
      // Sleep for duration < timeout and poll
      time.sleep(routerConfig.routerRequestNetworkTimeoutMs);
      requestRegistrationCallback.setRequestsToSend(new ArrayList<>());
      requestRegistrationCallback.setRequestsToDrop(new HashSet<>());
      op.poll(requestRegistrationCallback);
      Assert.assertTrue("No additional requests must be polled since existing requests haven't timed out",
          requestRegistrationCallback.getRequestsToSend().isEmpty());
      Assert.assertTrue("No requests should be timed out yet",
          requestRegistrationCallback.getRequestsToDrop().isEmpty());

      // Sleep for additional time out duration and poll
      time.sleep(deltaTimeOut + 1);
      op.poll(requestRegistrationCallback);
      if (!op.isOperationComplete()) {
        Assert.assertFalse("Next set of requests must be polled",
            requestRegistrationCallback.getRequestsToSend().isEmpty());
      }
      Assert.assertEquals("Mismatch in requests to be dropped", numRequestsToDrop,
          requestRegistrationCallback.getRequestsToDrop().size());

      count++;
    }

    Assert.assertEquals("Mismatch in expected number of polls",
        (int) Math.ceil((double) replicasCount / routerConfig.routerGetRequestParallelism), count);
    // At this time requests would have been created for all replicas, as none of them were delivered,
    // and cross-colo proxying is enabled by default.
    Assert.assertEquals("Must have attempted sending requests to all replicas", replicasCount,
        correlationIdToGetOperation.size());
    assertFailureAndCheckErrorCode(op, RouterErrorCode.OperationTimedOut);

    // test that timed out response won't update latency histogram if exclude timeout is enabled.
    assumeTrue(operationTrackerType.equals(AdaptiveOperationTracker.class.getSimpleName()));
    AdaptiveOperationTracker tracker = (AdaptiveOperationTracker) op.getFirstChunkOperationTrackerInUse();
    Histogram localColoTracker =
        tracker.getLatencyHistogram(RouterTestHelpers.getAnyReplica(blobId, true, localDcName));
    Histogram crossColoTracker =
        tracker.getLatencyHistogram(RouterTestHelpers.getAnyReplica(blobId, false, localDcName));
    Assert.assertEquals("Timed-out response shouldn't be counted into local colo latency histogram", 0,
        localColoTracker.getCount());
    Assert.assertEquals("Timed-out response shouldn't be counted into cross colo latency histogram", 0,
        crossColoTracker.getCount());
  }
Test the case where all requests dynamically time out at network layer within the GetOperation.
ambry-router/src/test/java/com/github/ambry/router/GetBlobOperationTest.java