/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.util.NonObfuscatable
 */
package com.l7tech.server.identity.ldap;

import com.l7tech.server.identity.ldap.HostnameVerifyingSSLSocketWrapper;
import com.l7tech.server.identity.ldap.LdapSslCustomizerSupport;
import com.l7tech.server.transport.http.SslClientSocketFactorySupport;
import com.l7tech.util.NonObfuscatable;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.util.Comparator;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.X509TrustManager;

public class LdapSSLSocketFactory
extends SslClientSocketFactorySupport
implements Comparator {
    @NonObfuscatable
    private static LdapSSLSocketFactory instance;
    @NonObfuscatable
    private HostnameVerifier hostnameVerifier;

    public static synchronized SSLSocketFactory getDefault() {
        try {
            if (instance == null) {
                instance = new LdapSSLSocketFactory();
            }
        }
        catch (UnsupportedOperationException unsupportedOperationException) {
            throw LdapSSLSocketFactory.a(unsupportedOperationException);
        }
        return instance;
    }

    @Override
    protected final X509TrustManager getTrustManager() {
        throw new UnsupportedOperationException();
    }

    @Override
    protected final SSLContext buildSSLContext() {
        throw new UnsupportedOperationException();
    }

    @Override
    protected final Socket notifyCreated(Socket socket, String string, InetAddress inetAddress, int n2, InetAddress inetAddress2, int n3) throws IOException {
        socket = this.a(socket);
        return socket;
    }

    @NonObfuscatable
    private HostnameVerifier getHostnameVerifier() {
        HostnameVerifier hostnameVerifier = this.hostnameVerifier;
        if (hostnameVerifier == null) {
            hostnameVerifier = this.hostnameVerifier = LdapSslCustomizerSupport.getHostnameVerifier();
        }
        return hostnameVerifier;
    }

    private Socket a(Socket object) {
        if (object instanceof SSLSocket) {
            SSLSocket sSLSocket = (SSLSocket)object;
            object = new HostnameVerifyingSSLSocketWrapper(sSLSocket, LdapSslCustomizerSupport.getHostnameVerifier());
        }
        return object;
    }

    private static UnsupportedOperationException a(UnsupportedOperationException unsupportedOperationException) {
        return unsupportedOperationException;
    }
}

