package o4;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.security.Provider;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import javax.net.ssl.SSLSocket;

/* JADX INFO: loaded from: classes3.dex */
public final class j extends l {

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

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

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

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final Class f21863h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public final Class f21864i;

    public j(Method method, Method method2, Method method3, Class cls, Class cls2, Provider provider) {
        super(provider);
        this.f21860e = method;
        this.f21861f = method2;
        this.f21862g = method3;
        this.f21863h = cls;
        this.f21864i = cls2;
    }

    @Override // o4.l
    public final void a(SSLSocket sSLSocket) {
        try {
            this.f21862g.invoke(null, sSLSocket);
        } catch (IllegalAccessException unused) {
            throw new AssertionError();
        } catch (InvocationTargetException e6) {
            l.f21868b.log(Level.FINE, "Failed to remove SSLSocket from Jetty ALPN", (Throwable) e6);
        }
    }

    @Override // o4.l
    public final void c(SSLSocket sSLSocket, String str, List list) {
        ArrayList arrayList = new ArrayList(list.size());
        int size = list.size();
        for (int i6 = 0; i6 < size; i6++) {
            m mVar = (m) list.get(i6);
            if (mVar != m.HTTP_1_0) {
                arrayList.add(mVar.f21877a);
            }
        }
        try {
            this.f21860e.invoke(null, sSLSocket, Proxy.newProxyInstance(l.class.getClassLoader(), new Class[]{this.f21863h, this.f21864i}, new k(arrayList)));
        } catch (IllegalAccessException e6) {
            throw new AssertionError(e6);
        } catch (InvocationTargetException e7) {
            throw new AssertionError(e7);
        }
    }

    @Override // o4.l
    public final String d(SSLSocket sSLSocket) {
        try {
            k kVar = (k) Proxy.getInvocationHandler(this.f21861f.invoke(null, sSLSocket));
            boolean z6 = kVar.f21866b;
            if (!z6 && kVar.f21867c == null) {
                l.f21868b.log(Level.INFO, "ALPN callback dropped: SPDY and HTTP/2 are disabled. Is alpn-boot on the boot class path?");
                return null;
            }
            if (z6) {
                return null;
            }
            return kVar.f21867c;
        } catch (IllegalAccessException unused) {
            throw new AssertionError();
        } catch (InvocationTargetException unused2) {
            throw new AssertionError();
        }
    }

    @Override // o4.l
    public final int e() {
        return 1;
    }
}
