@Test
  public void noResponseBodyTest() {
    EmbeddedChannel channel = createEmbeddedChannel();

    // with Transfer-Encoding:Chunked
    HttpRequest httpRequest =
        RestTestUtils.createRequest(HttpMethod.GET, TestingUri.ImmediateResponseComplete.toString(), null);
    channel.writeInbound(httpRequest);
    // There should be a response.
    HttpResponse response = channel.readOutbound();
    assertEquals("Unexpected response status", HttpResponseStatus.OK, response.status());
    assertTrue("Response must say 'Transfer-Encoding : chunked'", HttpUtil.isTransferEncodingChunked(response));
    // since this is Transfer-Encoding:chunked, there should be a LastHttpContent
    assertTrue("Did not receive end marker", channel.readOutbound() instanceof LastHttpContent);
    assertTrue("Channel should be alive", channel.isActive());

    // with Content-Length set
    HttpHeaders headers = new DefaultHttpHeaders();
    headers.set(MockNettyMessageProcessor.CHUNK_COUNT_HEADER_NAME, 0);
    httpRequest = RestTestUtils.createRequest(HttpMethod.GET, TestingUri.ImmediateResponseComplete.toString(), headers);
    HttpUtil.setKeepAlive(httpRequest, false);
    channel.writeInbound(httpRequest);
    // There should be a response.
    response = channel.readOutbound();
    assertEquals("Response must have Content-Length set to 0", 0,
        HttpUtil.getContentLength(response, NettyRequest.UNKNOWN_CONTENT_LENGTH));
    assertEquals("Unexpected response status", HttpResponseStatus.OK, response.status());
    // since Content-Length is set, the response should be an instance of FullHttpResponse.
    assertTrue("Response not instance of FullHttpResponse", response instanceof FullHttpResponse);
    assertFalse("Channel should not be alive", channel.isActive());
  }
Checks the case where no body needs to be returned but just a
{@link RestResponseChannel#onResponseComplete(Exception)} is called on the server. This should return just
response metadata.
ambry-rest/src/test/java/com/github/ambry/rest/NettyResponseChannelTest.java