@Test
  public void testResponseWithNullRequestInfo() throws Exception {
    try {
      Properties props = getNonBlockingRouterProperties(localDcName);
      VerifiableProperties verifiableProperties = new VerifiableProperties((props));
      RouterConfig routerConfig = new RouterConfig(verifiableProperties);
      routerMetrics = new NonBlockingRouterMetrics(mockClusterMap, routerConfig);
      NetworkClient mockNetworkClient = Mockito.mock(NetworkClient.class);
      Mockito.when(mockNetworkClient.warmUpConnections(anyList(), anyInt(), anyLong(), anyList())).thenReturn(1);
      doNothing().when(mockNetworkClient).close();
      List<ResponseInfo> responseInfoList = new ArrayList<>();
      MockDataNodeId testDataNode = (MockDataNodeId) mockClusterMap.getDataNodeIds().get(0);
      responseInfoList.add(new ResponseInfo(null, NetworkClientErrorCode.NetworkError, null, testDataNode, false));
      // By default, there are 1 operation controller and 1 background deleter thread. We set CountDownLatch to 3 so that
      // at least one thread has completed calling onResponse() and test node's state has been updated in ResponseHandler
      CountDownLatch invocationLatch = new CountDownLatch(3);
      doAnswer(invocation -> {
        invocationLatch.countDown();
        return responseInfoList;
      }).when(mockNetworkClient).sendAndPoll(anyList(), anySet(), anyInt());
      NetworkClientFactory networkClientFactory = Mockito.mock(NetworkClientFactory.class);
      Mockito.when(networkClientFactory.getNetworkClient()).thenReturn(mockNetworkClient);
      router = new NonBlockingRouter(routerConfig, routerMetrics, networkClientFactory, new LoggingNotificationSystem(),
          mockClusterMap, kms, cryptoService, cryptoJobHandler, accountService, mockTime,
          MockClusterMap.DEFAULT_PARTITION_CLASS, null);
      assertTrue("Invocation latch didn't count to 0 within 10 seconds", invocationLatch.await(10, TimeUnit.SECONDS));
      // verify the test node is considered timeout
      assertTrue("The node should be considered timeout", testDataNode.isTimedOut());
    } finally {
      if (router != null) {
        router.close();
      }
    }
  }
Test the case where request is timed out in the pending queue and network client returns response with null requestInfo
to mark node down via response handler.
@throws Exception
ambry-router/src/test/java/com/github/ambry/router/NonBlockingRouterTest.java