private void awaitResponse(AsyncRequestResponseHandler responseHandler, RestRequest restRequest,
      MockRestResponseChannel restResponseChannel, ReadableStreamChannel response, Exception exception)
      throws InterruptedException, RestServiceException {
    EventMonitor<MockRestResponseChannel.Event> eventMonitor =
        new EventMonitor<MockRestResponseChannel.Event>(MockRestResponseChannel.Event.OnRequestComplete);
    restResponseChannel.addListener(eventMonitor);
    responseHandler.handleResponse(restRequest, restResponseChannel, response, exception);
    if (!eventMonitor.awaitEvent(1, TimeUnit.SECONDS)) {
      fail("awaitResponse took too long. There might be a problem or the timeout may need to be increased");
    }
  }
Queues a response and waits while the response is completely sent out.
@param responseHandler the {@link AsyncRequestResponseHandler} instance to use.
@param restRequest the {@link RestRequest} to send to the {@code requestHandler}.
@param restResponseChannel the {@link RestResponseChannel} for responses.
@param response the response to send as a {@link ReadableStreamChannel}.
@param exception the exception that occurred while building the response, if any.
@throws InterruptedException
@throws RestServiceException
ambry-rest/src/test/java/com/github/ambry/rest/AsyncRequestResponseHandlerTest.java