package XnFJ5_9.Ft6VRog_36.KNBe_11;

import XnFJ5_9.XuVgy_28;
import com.wang.avi.BuildConfig;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import javax.annotation.Nullable;
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSocket;
/* compiled from: Jdk9Platform.java */
/* loaded from: classes.dex */
public final class Mqv2r_3 extends X6FRs_4 {
    public final Method KQgRr5e_0;
    public final Method QxJ9d_1;

    public Mqv2r_3(Method method, Method method2) {
        this.KQgRr5e_0 = method;
        this.QxJ9d_1 = method2;
    }

    @Override // XnFJ5_9.Ft6VRog_36.KNBe_11.X6FRs_4
    public void KQgRr5e_0(SSLSocket sSLSocket, String str, List<XuVgy_28> list) {
        try {
            SSLParameters sSLParameters = sSLSocket.getSSLParameters();
            List<String> KQgRr5e_0 = X6FRs_4.KQgRr5e_0(list);
            this.KQgRr5e_0.invoke(sSLParameters, KQgRr5e_0.toArray(new String[KQgRr5e_0.size()]));
            sSLSocket.setSSLParameters(sSLParameters);
        } catch (IllegalAccessException | InvocationTargetException unused) {
            throw new AssertionError("failed to set SSL parameters");
        }
    }

    @Override // XnFJ5_9.Ft6VRog_36.KNBe_11.X6FRs_4
    @Nullable
    public String KQgRr5e_0(SSLSocket sSLSocket) {
        try {
            String str = (String) this.QxJ9d_1.invoke(sSLSocket, new Object[0]);
            if (str != null) {
                if (str.equals(BuildConfig.FLAVOR)) {
                    return null;
                }
                return str;
            }
            return null;
        } catch (IllegalAccessException | InvocationTargetException unused) {
            throw new AssertionError("failed to get ALPN selected protocol");
        }
    }

    public static Mqv2r_3 KQgRr5e_0() {
        try {
            return new Mqv2r_3(SSLParameters.class.getMethod("setApplicationProtocols", String[].class), SSLSocket.class.getMethod("getApplicationProtocol", new Class[0]));
        } catch (NoSuchMethodException unused) {
            return null;
        }
    }
}
