public void addContent(ByteBuffer content) throws IOException {
    if (!RestMethod.POST.equals(getRestMethod()) && content != null) {
      throw new IllegalStateException("There is no content expected for " + getRestMethod());
    } else if (!isOpen()) {
      throw new ClosedChannelException();
    } else {
      contentLock.lock();
      try {
        if (!isOpen()) {
          throw new ClosedChannelException();
        }
        bytesReceived.getAndAdd(content != null ? content.remaining() : 0);
        if (writeChannel != null) {
          writeContent(writeChannel, callbackWrapper, content);
        } else {
          requestContents.add(content);
        }
      } finally {
        contentLock.unlock();
      }
    }
  }
Adds some content in the form of {@link ByteBuffer} to this RestRequest. This content will be available to read
through the read operations. To indicate end of content, add a null ByteBuffer.
@throws ClosedChannelException if request channel has been closed.
ambry-test-utils/src/main/java/com/github/ambry/rest/MockRestRequest.java