void () { CefClient client = myBrowser.getJBCefClient().getCefClient(); // Call CertificateErrorCallback with an unknown(for the custom trust manager) certificate { var callback = new CertificateErrorCallback(); boolean exit_code = client.onCertificateError(myBrowser.getCefBrowser(), CefLoadHandler.ErrorCode.ERR_CERT_AUTHORITY_INVALID, "some_url", mySSLInfo, callback ); callback.waitCall(); assertTrue(exit_code); assertTrue(callback.cancelCalled()); assertFalse(callback.continueCalled()); } for (var certificate : mySSLInfo.certificate.getCertificatesChain()) { CertificateManager.getInstance().getTrustManager().getCustomManager().addCertificate(certificate); } // Call CertificateErrorCallback with a known(for the custom trust manager) certificate { var callback = new CertificateErrorCallback(); boolean exit_code = client.onCertificateError(myBrowser.getCefBrowser(), CefLoadHandler.ErrorCode.ERR_CERT_AUTHORITY_INVALID, "some_url", mySSLInfo, callback ); callback.waitCall(); assertTrue(exit_code); assertTrue(callback.continueCalled()); assertFalse(callback.cancelCalled()); } for (var certificate : mySSLInfo.certificate.getCertificatesChain()) { CertificateManager.getInstance().getTrustManager().getCustomManager().removeCertificate(certificate); } // Remove the certificate from the custom trust manger { var callback = new CertificateErrorCallback(); boolean exit_code = client.onCertificateError(myBrowser.getCefBrowser(), CefLoadHandler.ErrorCode.ERR_CERT_AUTHORITY_INVALID, "some_url", mySSLInfo, callback ); callback.waitCall(); assertTrue(exit_code); assertFalse(callback.continueCalled()); assertTrue(callback.cancelCalled()); } }