package com.commit451.gitlab.ssl;

import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSession;

public class CustomHostnameVerifier implements HostnameVerifier {
    private static final HostnameVerifier DEFAULT_HOSTNAME_VERIFIER = HttpsURLConnection.getDefaultHostnameVerifier();
    private static String sLastFailedHostname;

    private final String mTrustedHostname;

    public CustomHostnameVerifier(String trustedHostname) {
        this.mTrustedHostname = trustedHostname;
    }

    @Override
    public boolean verify(String hostname, SSLSession session) {
        if (DEFAULT_HOSTNAME_VERIFIER.verify(hostname, session)) {
            sLastFailedHostname = null;
            return true;
        }

        if (mTrustedHostname != null && mTrustedHostname.equals(hostname)) {
            sLastFailedHostname = null;
            return true;
        }

        sLastFailedHostname = hostname;
        return false;
    }

    public static String getLastFailedHostname() {
        return sLastFailedHostname;
    }
}

@@ -35,30 +35,51 @@
 %0Aimport 
-javax.net.ssl.
+com.squareup.okhttp.internal.tls.Ok
 Hostname
@@ -88,16 +88,17 @@
 rifier;%0A
+%0A
 import j
@@ -111,33 +111,31 @@
 et.ssl.H
-ttpsURLConnection
+ostnameVerifier
 ;%0Aimport
@@ -302,37 +302,10 @@
 R = 
-HttpsURLConnection.getDefault
+Ok
 Host
@@ -316,18 +316,25 @@
 Verifier
-()
+.INSTANCE
 ;%0A    pr

Change CustomHostnameVerifier to use default OkHostnameVerifier