protected void handleResponse(RestRequest restRequest, RestResponseChannel restResponseChannel,
      ReadableStreamChannel response, Exception exception) {
    try {
      if (exception != null && exception instanceof RouterException) {
        exception = new RestServiceException(exception,
            RestServiceErrorCode.getRestServiceErrorCode(((RouterException) exception).getErrorCode()));
      }
      responseHandler.handleResponse(restRequest, restResponseChannel, response, exception);
    } catch (RestServiceException e) {
      exception = exception == null ? e : exception;
      restResponseChannel.onResponseComplete(exception);
      if (response != null) {
        try {
          response.close();
        } catch (IOException ioe) {
          throw new IllegalStateException(ioe);
        }
      }
    }
  }
Sends out responses immediately. Returns control only after {@code response} has been consumed and sent over the
{@code restResponseChannel}.
<p/>
If the response building was unsuccessful for any reason, the details are included in the {@code exception}.
<p/>
The bytes consumed from the {@code response} are streamed out (unmodified) through the {@code restResponseChannel}.
<p/>
Assumed that at least one of {@code response} or {@code exception} is null.
@param restRequest the {@link RestRequest} for which the response has been constructed.
@param restResponseChannel the {@link RestResponseChannel} to be used to send the response.
@param response a {@link ReadableStreamChannel} that represents the response to the {@code restRequest}.
@param exception if the response could not be constructed, the reason for the failure.
ambry-api/src/test/java/com/github/ambry/rest/MockRestRequestService.java