TEST_F(EncryptedRecordTest, TestWriteSplittingWholeBuf) {
  TLSMessage msg{ContentType::application_data, IOBuf::create(2000)};
  msg.fragment->append(2000);
  memset(msg.fragment->writableData(), 0x1, msg.fragment->length());
  msg.fragment->prependChain(IOBuf::copyBuffer("moredata"));

  Sequence s;
  EXPECT_CALL(*writeAead_, _encrypt(_, _, _))
      .Times(2)
      .WillRepeatedly(
          Invoke([](std::unique_ptr<IOBuf>& /*buf*/, const IOBuf*, uint64_t) {
            return getBuf("aaaa");
          }));
  write_.write(std::move(msg));
}
TEST_F(EncryptedRecordTest, TestWriteSplittingWholeBuf) {
  TLSMessage msg{ContentType::application_data, IOBuf::create(2000)};
  msg.fragment->append(2000);
  memset(msg.fragment->writableData(), 0x1, msg.fragment->length());
  msg.fragment->prependChain(IOBuf::copyBuffer("moredata"));

  Sequence s;
  EXPECT_CALL(*writeAead_, _encrypt(_, _, _))
      .Times(2)
      .WillRepeatedly(
          Invoke([](std::unique_ptr<IOBuf>&  , const IOBuf*, uint64_t) {
            return getBuf("aaaa");
          }));
  write_.write(std::move(msg));
}