Files
rr3-apk/decompiled/sources/okhttp3/internal/platform/Jdk9Platform.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

59 lines
2.2 KiB
Java

package okhttp3.internal.platform;
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: classes5.dex */
public final class Jdk9Platform extends Platform {
public final Method getProtocolMethod;
public final Method setProtocolMethod;
public Jdk9Platform(Method method, Method method2) {
this.setProtocolMethod = method;
this.getProtocolMethod = method2;
}
@Override // okhttp3.internal.platform.Platform
public void configureTlsExtensions(SSLSocket sSLSocket, String str, List list) {
try {
SSLParameters sSLParameters = sSLSocket.getSSLParameters();
List alpnProtocolNames = Platform.alpnProtocolNames(list);
this.setProtocolMethod.invoke(sSLParameters, alpnProtocolNames.toArray(new String[alpnProtocolNames.size()]));
sSLSocket.setSSLParameters(sSLParameters);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new AssertionError("failed to set SSL parameters", e);
}
}
@Override // okhttp3.internal.platform.Platform
public String getSelectedProtocol(SSLSocket sSLSocket) {
try {
String str = (String) this.getProtocolMethod.invoke(sSLSocket, new Object[0]);
if (str != null) {
if (!str.equals("")) {
return str;
}
}
return null;
} catch (IllegalAccessException e) {
throw new AssertionError("failed to get ALPN selected protocol", e);
} catch (InvocationTargetException e2) {
if (e2.getCause() instanceof UnsupportedOperationException) {
return null;
}
throw new AssertionError("failed to get ALPN selected protocol", e2);
}
}
public static Jdk9Platform buildIfSupported() {
try {
return new Jdk9Platform(SSLParameters.class.getMethod("setApplicationProtocols", String[].class), SSLSocket.class.getMethod("getApplicationProtocol", new Class[0]));
} catch (NoSuchMethodException unused) {
return null;
}
}
}