use of okhttp3.internal.tls.CertificateChainCleaner in project okhttp by square.
the class CertificateChainCleanerTest method unorderedChainOfCertificatesWithoutRoot.
@Test
public void unorderedChainOfCertificatesWithoutRoot() throws Exception {
HeldCertificate root = new HeldCertificate.Builder().serialNumber("1").build();
HeldCertificate certA = new HeldCertificate.Builder().serialNumber("2").issuedBy(root).build();
HeldCertificate certB = new HeldCertificate.Builder().serialNumber("3").issuedBy(certA).build();
HeldCertificate certC = new HeldCertificate.Builder().serialNumber("4").issuedBy(certB).build();
CertificateChainCleaner cleaner = CertificateChainCleaner.get(root.certificate);
assertEquals(list(certC, certB, certA, root), cleaner.clean(list(certC, certA, certB), "hostname"));
}
Aggregations