@Override
  protected void prepareBuffer() {
    super.prepareBuffer();
    bufferToSend.writeBytes(blobId.toBytes());
    bufferToSend.writeInt(sourceHostName.length());
    bufferToSend.writeBytes(sourceHostName.getBytes());
    bufferToSend.writeInt(sourceHostPort);

    if (versionId == VERSION_2) {
      bufferToSend.writeShort((short) operationType.ordinal());
      bufferToSend.writeLong(operationTimeInMs);
      bufferToSend.writeShort(lifeVersion);
      bufferToSend.writeLong(expirationTimeInMs);
    }
  }
Construct the bufferToSend to serialize the request
ambry-protocol/src/main/java/com/github/ambry/protocol/ReplicateBlobRequest.java