c.java 源代码
package q3;
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;
import okhttp3.v;
public final class c extends f {
final Method f25726c;
final Method f25727d;
c(Method method, Method method2) {
this.f25726c = method;
this.f25727d = method2;
}
public static c r() {
try {
return new c(SSLParameters.class.getMethod("setApplicationProtocols", String[].class), SSLSocket.class.getMethod("getApplicationProtocol", new Class[0]));
} catch (NoSuchMethodException unused) {
return null;
}
}
@Override
public void f(SSLSocket sSLSocket, String str, List<v> list) {
try {
SSLParameters sSLParameters = sSLSocket.getSSLParameters();
List<String> b6 = f.b(list);
this.f25726c.invoke(sSLParameters, b6.toArray(new String[b6.size()]));
sSLSocket.setSSLParameters(sSLParameters);
} catch (IllegalAccessException | InvocationTargetException e6) {
throw j3.c.a("unable to set ssl parameters", e6);
}
}
@Override
@Nullable
public String l(SSLSocket sSLSocket) {
try {
String str = (String) this.f25727d.invoke(sSLSocket, new Object[0]);
if (str != null) {
if (!str.equals("")) {
return str;
}
return null;
}
return null;
} catch (IllegalAccessException | InvocationTargetException e6) {
throw j3.c.a("unable to get selected protocols", e6);
}
}
}