@Test
  public void getAsyncRequestResponseHandlerTest() throws InstantiationException, IOException {
    Properties properties = new Properties();
    VerifiableProperties verifiableProperties = new VerifiableProperties(properties);
    Router router = new InMemoryRouter(verifiableProperties, new MockClusterMap(), null);

    RestRequestService restRequestService = new MockRestRequestService(verifiableProperties, router);
    AsyncRequestResponseHandlerFactory handlerFactory =
        new AsyncRequestResponseHandlerFactory(1, new MetricRegistry(), restRequestService);
    // Get response handler.
    RestResponseHandler restResponseHandler = handlerFactory.getRestResponseHandler();
    assertNotNull("No RestResponseHandler returned", restResponseHandler);
    assertEquals("Did not receive an AsyncRequestResponseHandler instance",
        AsyncRequestResponseHandler.class.getCanonicalName(), restResponseHandler.getClass().getCanonicalName());

    // Get request handler.
    RestRequestHandler restRequestHandler = handlerFactory.getRestRequestHandler();
    assertNotNull("No RestRequestHandler returned", restRequestHandler);
    assertEquals("Did not receive an AsyncRequestResponseHandler instance",
        AsyncRequestResponseHandler.class.getCanonicalName(), restRequestHandler.getClass().getCanonicalName());

    // make sure they are same instance
    assertEquals("Instances of AsyncRequestResponseHandler are not the same", restResponseHandler, restRequestHandler);

    // make sure the instance starts and shuts down OK.
    restRequestHandler.start();
    restRequestHandler.shutdown();
  }
Tests the instantiation of an {@link AsyncRequestResponseHandler} instance through the
{@link AsyncRequestResponseHandlerFactory}.
@throws InstantiationException
ambry-rest/src/test/java/com/github/ambry/rest/AsyncRequestResponseHandlerFactoryTest.java