private static void assertForeign(HpkeContext context) {
        // Context's SPI should be duck typed, because the foreign Provider returns instances
        // which use HpkeForeignSpi which *doesn't* implement HpkeSpi.
        assertTrue(context.getSpi() instanceof DuckTypedHpkeSpi);
        DuckTypedHpkeSpi duckTyped = (DuckTypedHpkeSpi) context.getSpi();

        // Verify the SPI is indeed foreign.
        assertTrue(duckTyped.getDelegate() instanceof HpkeForeignSpi);

        // And that it is delegating to a real implementation, so we can test it.
        assertNotNull(duckTyped.getDelegate());
    }
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