@Test
public void testEncryptDecrypt_smallestPossibleRecordSize() throws Exception {

  KeyPair uaKeyPair = EllipticCurves.generateKeyPair(WebPushConstants.NIST_P256_CURVE_TYPE);
  ECPrivateKey uaPrivateKey = (ECPrivateKey) uaKeyPair.getPrivate();
  ECPublicKey uaPublicKey = (ECPublicKey) uaKeyPair.getPublic();
  byte[] authSecret = Random.randBytes(16);
  // Test with smallest possible record size.
  HybridEncrypt hybridEncrypt =
      new WebPushHybridEncrypt.Builder()
          .withRecordSize(WebPushConstants.CIPHERTEXT_OVERHEAD)
          .withAuthSecret(authSecret)
          .withRecipientPublicKey(uaPublicKey)
          .build();
  HybridDecrypt hybridDecrypt =
      new WebPushHybridDecrypt.Builder()
          .withRecordSize(WebPushConstants.CIPHERTEXT_OVERHEAD)
          .withAuthSecret(authSecret)
          .withRecipientPublicKey(uaPublicKey)
          .withRecipientPrivateKey(uaPrivateKey)
          .build();
  byte[] plaintext = new byte[0];
  byte[] ciphertext = hybridEncrypt.encrypt(plaintext, null /* contextInfo */);
  assertEquals(ciphertext.length, plaintext.length + WebPushConstants.CIPHERTEXT_OVERHEAD);
  assertArrayEquals(plaintext, hybridDecrypt.decrypt(ciphertext, null /* contextInfo */));
}