private void testHpkeEncryption(HpkeData record) throws Exception {
        final byte[] enc = record.pkEm;

        // Encryption
        final HpkeContextSender contextSender =
            setupBaseForTesting(record.hpkeSuite, record.pkRm, record.info, record.skEm);
        assertForeign(contextSender);
        final byte[] encResult = contextSender.getEncapsulated();
        assertArrayEquals("Failed encryption 'enc' " + encodeHex(enc), enc, encResult);
        for (HpkeEncryptionData encryption : record.encryptions) {
            final byte[] ciphertext = contextSender.seal(encryption.pt, encryption.aad);
            assertArrayEquals("Failed encryption 'ciphertext' on data : " + encryption,
                encryption.ct, ciphertext);
        }

        // Decryption
        final HpkeContextRecipient contextRecipient =
            HpkeContextRecipient.getInstance(record.hpkeSuite.name());
        assertForeign(contextRecipient);
        contextRecipient.init(enc, record.skRm, record.info);
        for (HpkeEncryptionData encryption : record.encryptions) {
            final byte[] plaintext = contextRecipient.open(encryption.ct, encryption.aad);
            assertArrayEquals(
                "Failed decryption on data : " + encryption, encryption.pt, plaintext);
        }
    }
Tests for DuckTypedHpkeSpiTest. Essentially the same as the tests for HpkeContext but
with a "foreign" HPKE Provider inserted ahead of Conscrypt. That is, one which returns
SPI instances with all the correct methods but which don't inherit directly from "our"
HpkeSpi.
common/src/test/java/org/conscrypt/DuckTypedHpkeSpiTest.java