private void sendRequestCheckResponse(EmbeddedChannel channel, HttpMethod httpMethod, RestMethod restMethod,
      boolean isKeepAlive) throws IOException {
    long requestId = REQUEST_ID_GENERATOR.getAndIncrement();
    String uri = MockRestRequestService.ECHO_REST_METHOD + requestId;
    HttpRequest httpRequest = RestTestUtils.createRequest(httpMethod, uri, null);
    HttpUtil.setKeepAlive(httpRequest, isKeepAlive);
    channel.writeInbound(httpRequest);
    channel.writeInbound(new DefaultLastHttpContent());
    HttpResponse response = (HttpResponse) channel.readOutbound();
    assertEquals("Unexpected response status", HttpResponseStatus.OK, response.status());
    // MockRestRequestService echoes the RestMethod + request id.
    String expectedResponse = restMethod.toString() + requestId;
    assertEquals("Unexpected content", expectedResponse,
        RestTestUtils.getContentString((HttpContent) channel.readOutbound()));
    assertTrue("End marker was expected", channel.readOutbound() instanceof LastHttpContent);
  }
Sends the provided {@code httpRequest} and verifies that the response is an echo of the {@code restMethod}.
@param channel the {@link EmbeddedChannel} to send the request over.
@param httpMethod the {@link HttpMethod} for the request.
@param restMethod the equivalent {@link RestMethod} for {@code httpMethod}. Used to check for correctness of
                  response.
@param isKeepAlive if the request needs to be keep-alive.
@throws IOException
ambry-rest/src/test/java/com/github/ambry/rest/NettyMessageProcessorTest.java