@Test
  public void useServiceWithoutStartTest() throws IOException, JSONException, URISyntaxException {
    AsyncRequestResponseHandler handler = getAsyncRequestResponseHandler(1);
    RestRequest restRequest = createRestRequest(RestMethod.GET, "/", null, null);
    try {
      handler.handleRequest(restRequest, new MockRestResponseChannel());
      fail("Should have thrown RestServiceException because the AsyncRequestResponseHandler has not been started");
    } catch (RestServiceException e) {
      assertEquals("The RestServiceErrorCode does not match", RestServiceErrorCode.ServiceUnavailable,
          e.getErrorCode());
    }

    restRequest = createRestRequest(RestMethod.GET, "/", null, null);
    restRequest.getMetricsTracker().scalingMetricsTracker.markRequestReceived();
    try {
      handler.handleResponse(restRequest, new MockRestResponseChannel(),
          new ByteBufferReadableStreamChannel(ByteBuffer.allocate(0)), null);
      fail("Should have thrown RestServiceException because the AsyncRequestResponseHandler has not been started");
    } catch (RestServiceException e) {
      assertEquals("The RestServiceErrorCode does not match", RestServiceErrorCode.ServiceUnavailable,
          e.getErrorCode());
    }
  }
This tests for exceptions thrown when a {@link AsyncRequestResponseHandler} is used without calling
{@link AsyncRequestResponseHandler#start()}first.
@throws IOException
@throws JSONException
@throws URISyntaxException
ambry-rest/src/test/java/com/github/ambry/rest/AsyncRequestResponseHandlerTest.java