Buf EncryptedWriteRecordLayer::getBufToEncrypt(folly::IOBufQueue& queue) const {
  if (queue.front()->length() > maxRecord_) {
    return queue.splitAtMost(maxRecord_);
  } else if (queue.front()->length() >= desiredMinRecord_) {
    return queue.pop_front();
  } else {
    return queue.splitAtMost(desiredMinRecord_);
  }
}
Buf EncryptedWriteRecordLayer::getBufToEncrypt(folly::IOBufQueue& queue) const {
  if (queue.front()->length() > maxRecord_) {
    return queue.splitAtMost(maxRecord_);
  } else if (queue.front()->length() >= desiredMinRecord_) {
    return queue.pop_front();
  } else {
    return queue.splitAtMost(desiredMinRecord_);
  }
}