@Test
  public void testPollAndResponseHandling() throws Exception {
    for (short expectedLifeVersion : new short[]{0, 1}) {
      router.currentOperationsCount.incrementAndGet();
      // Now set the lifeVersion
      for (MockServer mockServer : mockServerLayout.getMockServers()) {
        if (mockServer.getBlobs().containsKey(blobId.getID())) {
          mockServer.getBlobs().get(blobId.getID()).lifeVersion = expectedLifeVersion;
        }
      }
      GetBlobInfoOperation op =
          new GetBlobInfoOperation(routerConfig, routerMetrics, mockClusterMap, responseHandler, blobId, options, null,
              routerCallback, kms, cryptoService, cryptoJobHandler, time, false, quotaChargeCallback, router);
      ArrayList<RequestInfo> requestListToFill = new ArrayList<>();
      requestRegistrationCallback.setRequestsToSend(requestListToFill);
      op.poll(requestRegistrationCallback);
      Assert.assertEquals("There should only be as many requests at this point as requestParallelism",
          requestParallelism, correlationIdToGetOperation.size());

      CountDownLatch onPollLatch = new CountDownLatch(1);
      if (testEncryption) {
        routerCallback.setOnPollLatch(onPollLatch);
      }
      List<ResponseInfo> responses = sendAndWaitForResponses(requestListToFill);
      for (ResponseInfo responseInfo : responses) {
        GetResponse getResponse = responseInfo.getError() == null ? GetResponse.readFrom(
            new NettyByteBufDataInputStream(responseInfo.content()), mockClusterMap) : null;
        op.handleResponse(responseInfo, getResponse);
        if (op.isOperationComplete()) {
          break;
        }
      }
      responses.forEach(ResponseInfo::release);
      if (testEncryption) {
        Assert.assertTrue("Latch should have been zeroed ", onPollLatch.await(500, TimeUnit.MILLISECONDS));
        op.poll(requestRegistrationCallback);
      }
      Assert.assertTrue("Operation should be complete at this time", op.isOperationComplete());
      assertSuccess(op, expectedLifeVersion);
      // poll again to make sure that counters aren't triggered again (check in @After)
      op.poll(requestRegistrationCallback);
      correlationIdToGetOperation.clear();
    }
  }
Test basic successful operation completion, by polling and handing over responses to the BlobInfo operation.
@throws Exception
ambry-router/src/test/java/com/github/ambry/router/GetBlobInfoOperationTest.java