private void copyHeaders(HttpRequest httpRequest) throws RestServiceException {
    restResponseChannel.setStatus(ResponseStatus.Accepted);
    assertEquals("ResponseStatus differs from what was set", ResponseStatus.Accepted, restResponseChannel.getStatus());

    restResponseChannel.setHeader(RestUtils.Headers.CONTENT_TYPE,
        httpRequest.headers().get(HttpHeaderNames.CONTENT_TYPE));
    assertEquals("Value of [" + RestUtils.Headers.CONTENT_TYPE + "] differs from what was set",
        httpRequest.headers().get(HttpHeaderNames.CONTENT_TYPE),
        restResponseChannel.getHeader(HttpHeaderNames.CONTENT_TYPE.toString()));

    restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH,
        Long.parseLong(httpRequest.headers().get(HttpHeaderNames.CONTENT_LENGTH)));
    assertEquals("Value of [" + RestUtils.Headers.CONTENT_LENGTH + "] differs from what was set",
        httpRequest.headers().get(HttpHeaderNames.CONTENT_LENGTH),
        restResponseChannel.getHeader(HttpHeaderNames.CONTENT_LENGTH.toString()));

    restResponseChannel.setHeader(RestUtils.Headers.LOCATION, httpRequest.headers().get(HttpHeaderNames.LOCATION));
    assertEquals("Value of [" + RestUtils.Headers.LOCATION + "] differs from what was set",
        httpRequest.headers().get(HttpHeaderNames.LOCATION),
        restResponseChannel.getHeader(HttpHeaderNames.LOCATION.toString()));

    restResponseChannel.setHeader(RestUtils.Headers.LAST_MODIFIED,
        new Date(httpRequest.headers().getTimeMillis(HttpHeaderNames.LAST_MODIFIED)));
    assertEquals("Value of [" + RestUtils.Headers.LAST_MODIFIED + "] differs from what was set",
        httpRequest.headers().get(HttpHeaderNames.LAST_MODIFIED),
        restResponseChannel.getHeader(HttpHeaderNames.LAST_MODIFIED.toString()));

    restResponseChannel.setHeader(RestUtils.Headers.EXPIRES,
        new Date(httpRequest.headers().getTimeMillis(HttpHeaderNames.EXPIRES)));
    assertEquals("Value of [" + RestUtils.Headers.EXPIRES + "] differs from what was set",
        httpRequest.headers().get(HttpHeaderNames.EXPIRES),
        restResponseChannel.getHeader(HttpHeaderNames.EXPIRES.toString()));

    restResponseChannel.setHeader(RestUtils.Headers.CACHE_CONTROL,
        httpRequest.headers().get(HttpHeaderNames.CACHE_CONTROL));
    assertEquals("Value of [" + RestUtils.Headers.CACHE_CONTROL + "] differs from what was set",
        httpRequest.headers().get(HttpHeaderNames.CACHE_CONTROL),
        restResponseChannel.getHeader(HttpHeaderNames.CACHE_CONTROL.toString()));

    restResponseChannel.setHeader(RestUtils.Headers.PRAGMA, httpRequest.headers().get(HttpHeaderNames.PRAGMA));
    assertEquals("Value of [" + RestUtils.Headers.PRAGMA + "] differs from what was set",
        httpRequest.headers().get(HttpHeaderNames.PRAGMA),
        restResponseChannel.getHeader(HttpHeaderNames.PRAGMA.toString()));

    restResponseChannel.setHeader(RestUtils.Headers.DATE,
        new Date(httpRequest.headers().getTimeMillis(HttpHeaderNames.DATE)));
    assertEquals("Value of [" + RestUtils.Headers.DATE + "] differs from what was set",
        httpRequest.headers().get(HttpHeaderNames.DATE),
        restResponseChannel.getHeader(HttpHeaderNames.DATE.toString()));

    restResponseChannel.setHeader(CUSTOM_HEADER_NAME, httpRequest.headers().get(CUSTOM_HEADER_NAME));
    assertEquals("Value of [" + CUSTOM_HEADER_NAME + "] differs from what was set",
        httpRequest.headers().get(CUSTOM_HEADER_NAME), restResponseChannel.getHeader(CUSTOM_HEADER_NAME));
  }
Copies headers from request to response.
@param httpRequest the {@link HttpRequest} to copy headers from.
@throws RestServiceException
ambry-rest/src/test/java/com/github/ambry/rest/NettyResponseChannelTest.java