private NettyRequest createNettyRequest(HttpMethod httpMethod, String uri, HttpHeaders headers, Channel channel)
      throws RestServiceException {
    MetricRegistry metricRegistry = new MetricRegistry();
    RestRequestMetricsTracker.setDefaults(metricRegistry);
    HttpRequest httpRequest = new DefaultHttpRequest(HttpVersion.HTTP_1_1, httpMethod, uri, false);
    if (headers != null) {
      httpRequest.headers().set(headers);
    }
    NettyRequest nettyRequest =
        new NettyRequest(httpRequest, channel, new NettyMetrics(metricRegistry), DENY_LISTED_QUERY_PARAM_SET);
    assertEquals("Auto-read is in an invalid state",
        (!httpMethod.equals(HttpMethod.POST) && !httpMethod.equals(HttpMethod.PUT))
            || NettyRequest.bufferWatermark <= 0, channel.config().isAutoRead());
    return nettyRequest;
  }
Creates a {@link NettyRequest} with the given parameters.
@param httpMethod the {@link HttpMethod} desired.
@param uri the URI desired.
@param headers {@link HttpHeaders} that need to be a part of the request.
@param channel the {@link Channel} that the request arrived over.
@return {@link NettyRequest} encapsulating a {@link HttpRequest} with the given parameters.
@throws RestServiceException if the {@code httpMethod} is not recognized by {@link NettyRequest}.
ambry-rest/src/test/java/com/github/ambry/rest/NettyRequestTest.java