package u9; import com.google.android.gms.ads.RequestConfiguration; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.List; import javax.net.ssl.SSLParameters; import javax.net.ssl.SSLSocket; /* loaded from: classes2.dex */ final class i extends j { /* renamed from: c, reason: collision with root package name */ final Method f14759c; /* renamed from: d, reason: collision with root package name */ final Method f14760d; i(Method method, Method method2) { this.f14759c = method; this.f14760d = method2; } public static i u() { try { return new i(SSLParameters.class.getMethod("setApplicationProtocols", String[].class), SSLSocket.class.getMethod("getApplicationProtocol", new Class[0])); } catch (NoSuchMethodException unused) { return null; } } @Override // u9.j public void g(SSLSocket sSLSocket, String str, List list) { try { SSLParameters sSLParameters = sSLSocket.getSSLParameters(); List b10 = j.b(list); this.f14759c.invoke(sSLParameters, b10.toArray(new String[b10.size()])); sSLSocket.setSSLParameters(sSLParameters); } catch (IllegalAccessException | InvocationTargetException e10) { throw new AssertionError("failed to set SSL parameters", e10); } } @Override // u9.j public String n(SSLSocket sSLSocket) { try { String str = (String) this.f14760d.invoke(sSLSocket, new Object[0]); if (str != null) { if (!str.equals(RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED)) { return str; } } return null; } catch (IllegalAccessException e10) { throw new AssertionError("failed to get ALPN selected protocol", e10); } catch (InvocationTargetException e11) { if (e11.getCause() instanceof UnsupportedOperationException) { return null; } throw new AssertionError("failed to get ALPN selected protocol", e11); } } }