mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-12-05 20:09:49 +01:00
91 lines
5.2 KiB
Java
91 lines
5.2 KiB
Java
package okhttp3.internal.platform.android;
|
|
|
|
import java.util.List;
|
|
import javax.net.ssl.SSLSocket;
|
|
import javax.net.ssl.SSLSocketFactory;
|
|
import javax.net.ssl.X509TrustManager;
|
|
import kotlin.Metadata;
|
|
import okhttp3.Protocol;
|
|
import okhttp3.internal.platform.android.SocketAdapter;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@Metadata(d1 = {"\u00008\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0003\u0018\u00002\u00020\u0001:\u0001\u0014B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J(\u0010\u0006\u001a\u00020\u00072\u0006\u0010\b\u001a\u00020\t2\b\u0010\n\u001a\u0004\u0018\u00010\u000b2\f\u0010\f\u001a\b\u0012\u0004\u0012\u00020\u000e0\rH\u0016J\u0012\u0010\u000f\u001a\u0004\u0018\u00010\u00012\u0006\u0010\b\u001a\u00020\tH\u0002J\u0012\u0010\u0010\u001a\u0004\u0018\u00010\u000b2\u0006\u0010\b\u001a\u00020\tH\u0016J\b\u0010\u0011\u001a\u00020\u0012H\u0016J\u0010\u0010\u0013\u001a\u00020\u00122\u0006\u0010\b\u001a\u00020\tH\u0016R\u0010\u0010\u0005\u001a\u0004\u0018\u00010\u0001X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0015"}, d2 = {"Lokhttp3/internal/platform/android/DeferredSocketAdapter;", "Lokhttp3/internal/platform/android/SocketAdapter;", "socketAdapterFactory", "Lokhttp3/internal/platform/android/DeferredSocketAdapter$Factory;", "(Lokhttp3/internal/platform/android/DeferredSocketAdapter$Factory;)V", "delegate", "configureTlsExtensions", "", "sslSocket", "Ljavax/net/ssl/SSLSocket;", "hostname", "", "protocols", "", "Lokhttp3/Protocol;", "getDelegate", "getSelectedProtocol", "isSupported", "", "matchesSocket", "Factory", "okhttp"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
|
/* loaded from: classes10.dex */
|
|
public final class DeferredSocketAdapter implements SocketAdapter {
|
|
|
|
@Nullable
|
|
private SocketAdapter delegate;
|
|
|
|
@NotNull
|
|
private final Factory socketAdapterFactory;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@Metadata(d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\bf\u0018\u00002\u00020\u0001J\u0010\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u0005H&J\u0010\u0010\u0006\u001a\u00020\u00072\u0006\u0010\u0004\u001a\u00020\u0005H&¨\u0006\b"}, d2 = {"Lokhttp3/internal/platform/android/DeferredSocketAdapter$Factory;", "", "create", "Lokhttp3/internal/platform/android/SocketAdapter;", "sslSocket", "Ljavax/net/ssl/SSLSocket;", "matchesSocket", "", "okhttp"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
|
public interface Factory {
|
|
@NotNull
|
|
SocketAdapter create(@NotNull SSLSocket sslSocket);
|
|
|
|
boolean matchesSocket(@NotNull SSLSocket sslSocket);
|
|
}
|
|
|
|
public DeferredSocketAdapter(@NotNull Factory factory) {
|
|
factory.getClass();
|
|
this.socketAdapterFactory = factory;
|
|
}
|
|
|
|
private final synchronized SocketAdapter getDelegate(SSLSocket sslSocket) {
|
|
try {
|
|
if (this.delegate == null && this.socketAdapterFactory.matchesSocket(sslSocket)) {
|
|
this.delegate = this.socketAdapterFactory.create(sslSocket);
|
|
}
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
return this.delegate;
|
|
}
|
|
|
|
@Override // okhttp3.internal.platform.android.SocketAdapter
|
|
public void configureTlsExtensions(@NotNull SSLSocket sslSocket, @Nullable String hostname, @NotNull List<? extends Protocol> protocols) {
|
|
sslSocket.getClass();
|
|
protocols.getClass();
|
|
SocketAdapter delegate = getDelegate(sslSocket);
|
|
if (delegate != null) {
|
|
delegate.configureTlsExtensions(sslSocket, hostname, protocols);
|
|
}
|
|
}
|
|
|
|
@Override // okhttp3.internal.platform.android.SocketAdapter
|
|
@Nullable
|
|
public String getSelectedProtocol(@NotNull SSLSocket sslSocket) {
|
|
sslSocket.getClass();
|
|
SocketAdapter delegate = getDelegate(sslSocket);
|
|
if (delegate != null) {
|
|
return delegate.getSelectedProtocol(sslSocket);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override // okhttp3.internal.platform.android.SocketAdapter
|
|
public boolean isSupported() {
|
|
return true;
|
|
}
|
|
|
|
@Override // okhttp3.internal.platform.android.SocketAdapter
|
|
public boolean matchesSocket(@NotNull SSLSocket sslSocket) {
|
|
sslSocket.getClass();
|
|
return this.socketAdapterFactory.matchesSocket(sslSocket);
|
|
}
|
|
|
|
@Override // okhttp3.internal.platform.android.SocketAdapter
|
|
public boolean matchesSocketFactory(@NotNull SSLSocketFactory sSLSocketFactory) {
|
|
return SocketAdapter.DefaultImpls.matchesSocketFactory(this, sSLSocketFactory);
|
|
}
|
|
|
|
@Override // okhttp3.internal.platform.android.SocketAdapter
|
|
@Nullable
|
|
public X509TrustManager trustManager(@NotNull SSLSocketFactory sSLSocketFactory) {
|
|
return SocketAdapter.DefaultImpls.trustManager(this, sSLSocketFactory);
|
|
}
|
|
}
|