what-the-bank/sources/io/grpc/okhttp/OkHttpChannelProvider.java

39 lines
1.6 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package io.grpc.okhttp;
import io.grpc.ChannelCredentials;
import io.grpc.InternalServiceProviders;
import io.grpc.ManagedChannelProvider;
import io.grpc.okhttp.OkHttpChannelBuilder;
/* loaded from: classes6.dex */
public final class OkHttpChannelProvider extends ManagedChannelProvider {
@Override // io.grpc.ManagedChannelProvider
public final boolean isAvailable() {
return true;
}
@Override // io.grpc.ManagedChannelProvider
public final int priority() {
return InternalServiceProviders.isAndroid(getClass().getClassLoader()) ? 8 : 3;
}
@Override // io.grpc.ManagedChannelProvider
public final OkHttpChannelBuilder builderForAddress(String str, int i) {
return OkHttpChannelBuilder.forAddress(str, i);
}
@Override // io.grpc.ManagedChannelProvider
public final OkHttpChannelBuilder builderForTarget(String str) {
return OkHttpChannelBuilder.forTarget(str);
}
@Override // io.grpc.ManagedChannelProvider
public final ManagedChannelProvider.NewChannelBuilderResult newChannelBuilder(String str, ChannelCredentials channelCredentials) {
OkHttpChannelBuilder.SslSocketFactoryResult sslSocketFactoryFrom = OkHttpChannelBuilder.sslSocketFactoryFrom(channelCredentials);
if (sslSocketFactoryFrom.error != null) {
return ManagedChannelProvider.NewChannelBuilderResult.error(sslSocketFactoryFrom.error);
}
return ManagedChannelProvider.NewChannelBuilderResult.channelBuilder(new OkHttpChannelBuilder(str, channelCredentials, sslSocketFactoryFrom.callCredentials, sslSocketFactoryFrom.factory));
}
}