package o5; 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 c extends a { /* renamed from: c, reason: collision with root package name */ final Method f12697c; /* renamed from: d, reason: collision with root package name */ final Method f12698d; c(Method method, Method method2) { this.f12697c = method; this.f12698d = method2; } public static c q() { try { return new c(SSLParameters.class.getMethod("setApplicationProtocols", String[].class), SSLSocket.class.getMethod("getApplicationProtocol", new Class[0])); } catch (NoSuchMethodException unused) { return null; } } @Override // o5.a public void h(SSLSocket sSLSocket, String str, List list) { try { SSLParameters sSLParameters = sSLSocket.getSSLParameters(); List d10 = a.d(list); this.f12697c.invoke(sSLParameters, d10.toArray(new String[d10.size()])); sSLSocket.setSSLParameters(sSLParameters); } catch (IllegalAccessException | InvocationTargetException e10) { throw i5.c.e("unable to set ssl parameters", e10); } } @Override // o5.a public String l(SSLSocket sSLSocket) { try { String str = (String) this.f12698d.invoke(sSLSocket, new Object[0]); if (str == null) { return null; } if (str.equals(RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED)) { return null; } return str; } catch (IllegalAccessException | InvocationTargetException e10) { throw i5.c.e("unable to get selected protocols", e10); } } }