@Test
    public void testDuplicateInChain() throws Exception {
        TestUtils.assumeExtendedTrustManagerAvailable();
        // chain3 should be server/intermediate/root
        KeyStore.PrivateKeyEntry pke = TestKeyStore.getServer().getPrivateKey("RSA", "RSA");
        X509Certificate[] chain3 = (X509Certificate[])pke.getCertificateChain();
        X509Certificate root = chain3[2];
        X509Certificate intermediate = chain3[1];
        X509Certificate server = chain3[0];

        X509Certificate[] chain4 = new X509Certificate[] { server, intermediate,
                                                           server, intermediate
        };
        assertValid(chain4, trustManager(root));
    }
Ensure that our non-standard behavior of learning to trust new
intermediate CAs does not regress. http://b/3404902
common/src/test/java/org/conscrypt/TrustManagerImplTest.java