private void handleContent(HttpContent httpContent) throws Exception {
    if (request != null) {
      boolean isLast = httpContent instanceof LastHttpContent;
      ChannelWriteCallback callback = new ChannelWriteCallback(httpContent);
      // Retain it here since SimpleChannelInboundHandler would auto release it after the channelRead0.
      // And release it in the callback.
      callback.setFuture(restResponseChannel.write(httpContent.content().retain(), callback));
      writeCallbacksToVerify.add(callback);
      if (isLast) {
        restResponseChannel.onResponseComplete(null);
        assertFalse("Request channel is not closed", request.isOpen());
      }
    } else {
      throw new RestServiceException("Received data without a request", RestServiceErrorCode.InvalidRequestState);
    }
  }
Handles a {@link HttpContent}. Checks state and echoes back the content.
@param httpContent the {@link HttpContent} that needs to be handled.
@throws Exception
ambry-rest/src/test/java/com/github/ambry/rest/NettyResponseChannelTest.java