package g.i0.j;

import g.x;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.X509TrustManager;

/* JADX INFO: loaded from: classes.dex */
public final class c extends f {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final Method f6406c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final Method f6407d;

    public c(Method method, Method method2) {
        this.f6406c = method;
        this.f6407d = method2;
    }

    @Override // g.i0.j.f
    public void f(SSLSocket sSLSocket, String str, List<x> list) {
        try {
            SSLParameters sSLParameters = sSLSocket.getSSLParameters();
            ArrayList arrayList = (ArrayList) f.b(list);
            this.f6406c.invoke(sSLParameters, arrayList.toArray(new String[arrayList.size()]));
            sSLSocket.setSSLParameters(sSLParameters);
        } catch (IllegalAccessException | InvocationTargetException e2) {
            throw g.i0.c.a("unable to set ssl parameters", e2);
        }
    }

    @Override // g.i0.j.f
    @Nullable
    public String i(SSLSocket sSLSocket) {
        try {
            String str = (String) this.f6407d.invoke(sSLSocket, new Object[0]);
            if (str == null) {
                return null;
            }
            if (str.equals("")) {
                return null;
            }
            return str;
        } catch (IllegalAccessException | InvocationTargetException e2) {
            throw g.i0.c.a("unable to get selected protocols", e2);
        }
    }

    @Override // g.i0.j.f
    public X509TrustManager o(SSLSocketFactory sSLSocketFactory) {
        throw new UnsupportedOperationException("clientBuilder.sslSocketFactory(SSLSocketFactory) not supported on JDK 9+");
    }
}
