private MockRestRequest createRestRequest(RestMethod method, String uri, JSONObject headers,
      List<ByteBuffer> contents) throws JSONException, UnsupportedEncodingException, URISyntaxException {
    JSONObject data = new JSONObject();
    data.put(MockRestRequest.REST_METHOD_KEY, method.name());
    data.put(MockRestRequest.URI_KEY, uri);
    if (headers != null) {
      data.put(MockRestRequest.HEADERS_KEY, headers);
    }
    return new MockRestRequest(data, contents);
  }
Creates a {@link MockRestRequest} with the given parameters.
@param method the {@link RestMethod} desired.
@param uri the URI to hit.
@param headers the headers that will accompany the request.
@param contents the content associated with the request.
@return a {@link MockRestRequest} based on the given parameters.
@throws JSONException
@throws UnsupportedEncodingException
@throws URISyntaxException
ambry-rest/src/test/java/com/github/ambry/rest/AsyncRequestResponseHandlerTest.java