File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
app/src/main/java/tech/httptoolkit/pinning_demo Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,8 @@ class MainActivity : AppCompatActivity() {
113
113
onStart(R .id.webview_unpinned)
114
114
val webView = WebView (this @MainActivity)
115
115
116
+ var connectionFailed = false
117
+
116
118
webView.loadUrl(" https://sha256.badssl.com" )
117
119
webView.webViewClient = object : WebViewClient () {
118
120
override fun onReceivedSslError (
@@ -121,9 +123,13 @@ class MainActivity : AppCompatActivity() {
121
123
error : SslError ?
122
124
) {
123
125
onError(R .id.webview_unpinned, error.toString())
126
+ connectionFailed = true
127
+ handler?.cancel()
124
128
}
125
129
126
130
override fun onPageFinished (view : WebView ? , url : String? ) {
131
+ if (connectionFailed) return
132
+
127
133
println (" Unpinned WebView loaded OK" )
128
134
onSuccess(R .id.webview_unpinned)
129
135
}
You can’t perform that action at this time.
0 commit comments