Here are the examples of the java api class android.net.http.SslError taken from open source projects.
1. AwContentsClientBridge#allowCertificateError()
Project: chromium_webview
File: AwContentsClientBridge.java
File: AwContentsClientBridge.java
// If returns false, the request is immediately canceled, and any call to proceedSslError // has no effect. If returns true, the request should be canceled or proceeded using // proceedSslError(). // Unlike the webview classic, we do not keep keep a database of certificates that // are allowed by the user, because this functionality is already handled via // ssl_policy in native layers. @CalledByNative private boolean allowCertificateError(int certError, byte[] derBytes, final String url, final int id) { final SslCertificate cert = SslUtil.getCertificateFromDerBytes(derBytes); if (cert == null) { // if the certificate or the client is null, cancel the request return false; } final SslError sslError = SslUtil.sslErrorFromNetErrorCode(certError, cert, url); ValueCallback<Boolean> callback = new ValueCallback<Boolean>() { @Override public void onReceiveValue(Boolean value) { proceedSslError(value.booleanValue(), id); } }; mClient.onReceivedSslError(callback, sslError); return true; }
2. OAuthWebViewClientTest#testOnReceivedSslError()
Project: twitter-kit-android
File: OAuthWebViewClientTest.java
File: OAuthWebViewClientTest.java
@Test public void testOnReceivedSslError() { final SslError mockSslError = mock(SslError.class); when(mockSslError.getPrimaryError()).thenReturn(TEST_ERROR_CODE); webViewClient.onReceivedSslError(mock(WebView.class), mock(SslErrorHandler.class), mockSslError); verifyOnError(TEST_ERROR_CODE, null, null); }