导航菜单

页面标题

页面副标题

SpeedCash v6.5.1482 - OkHttpChannelBuilder.java 源代码

正在查看: SpeedCash v6.5.1482 应用的 OkHttpChannelBuilder.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package io.grpc.okhttp;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import defpackage.rx5;
import io.grpc.CallCredentials;
import io.grpc.ChannelCredentials;
import io.grpc.ChannelLogger;
import io.grpc.ChoiceChannelCredentials;
import io.grpc.CompositeCallCredentials;
import io.grpc.CompositeChannelCredentials;
import io.grpc.ExperimentalApi;
import io.grpc.InsecureChannelCredentials;
import io.grpc.Internal;
import io.grpc.ManagedChannelBuilder;
import io.grpc.TlsChannelCredentials;
import io.grpc.internal.AbstractManagedChannelImplBuilder;
import io.grpc.internal.AtomicBackoff;
import io.grpc.internal.ClientTransportFactory;
import io.grpc.internal.ConnectionClientTransport;
import io.grpc.internal.FixedObjectPool;
import io.grpc.internal.GrpcUtil;
import io.grpc.internal.KeepAliveManager;
import io.grpc.internal.ManagedChannelImplBuilder;
import io.grpc.internal.ObjectPool;
import io.grpc.internal.SharedResourceHolder;
import io.grpc.internal.SharedResourcePool;
import io.grpc.internal.TransportTracer;
import io.grpc.okhttp.SslSocketFactoryChannelCredentials;
import io.grpc.okhttp.internal.CipherSuite;
import io.grpc.okhttp.internal.ConnectionSpec;
import io.grpc.okhttp.internal.Platform;
import io.grpc.okhttp.internal.TlsVersion;
import io.grpc.util.CertificateUtils;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.security.GeneralSecurityException;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import javax.net.SocketFactory;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.KeyManager;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;

@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1785")
public final class OkHttpChannelBuilder extends AbstractManagedChannelImplBuilder<OkHttpChannelBuilder> {
    public static final int DEFAULT_FLOW_CONTROL_WINDOW = 65535;
    public static final Logger q = Logger.getLogger(OkHttpChannelBuilder.class.getName());
    public static final ConnectionSpec r = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS).cipherSuites(CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, CipherSuite.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, CipherSuite.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, CipherSuite.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256).tlsVersions(TlsVersion.TLS_1_2).supportsTlsExtensions(true).build();
    public static final long s = TimeUnit.DAYS.toNanos(1000);
    public static final SharedResourceHolder.Resource<Executor> t;
    public static final ObjectPool<Executor> u;
    public static final EnumSet<TlsChannelCredentials.Feature> v;
    public final ManagedChannelImplBuilder a;
    public TransportTracer.Factory b;
    public ObjectPool<Executor> c;
    public ObjectPool<ScheduledExecutorService> d;
    public SocketFactory e;
    public SSLSocketFactory f;
    public final boolean g;
    public HostnameVerifier h;
    public ConnectionSpec i;
    public c j;
    public long k;
    public long l;
    public int m;
    public boolean n;
    public int o;
    public final boolean p;

    public class a implements SharedResourceHolder.Resource<Executor> {
        @Override
        public void close(Executor executor) {
            ((ExecutorService) executor).shutdown();
        }

        @Override
        public Executor create() {
            return Executors.newCachedThreadPool(GrpcUtil.getThreadFactory("grpc-okhttp-%d", true));
        }
    }

    public static class b {
        public static final int[] a;
        public static final int[] b;

        static {
            int[] iArr = new int[c.values().length];
            b = iArr;
            try {
                iArr[c.PLAINTEXT.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                b[c.TLS.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            int[] iArr2 = new int[NegotiationType.values().length];
            a = iArr2;
            try {
                iArr2[NegotiationType.TLS.ordinal()] = 1;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                a[NegotiationType.PLAINTEXT.ordinal()] = 2;
            } catch (NoSuchFieldError unused4) {
            }
        }
    }

    public enum c {
        TLS,
        PLAINTEXT
    }

    public final class d implements ManagedChannelImplBuilder.ChannelBuilderDefaultPortProvider {
        public d() {
        }

        @Override
        public int getDefaultPort() {
            return OkHttpChannelBuilder.this.h();
        }

        public d(OkHttpChannelBuilder okHttpChannelBuilder, a aVar) {
            this();
        }
    }

    public final class e implements ManagedChannelImplBuilder.ClientTransportFactoryBuilder {
        public e() {
        }

        @Override
        public ClientTransportFactory buildClientTransportFactory() {
            return OkHttpChannelBuilder.this.b();
        }

        public e(OkHttpChannelBuilder okHttpChannelBuilder, a aVar) {
            this();
        }
    }

    @Internal
    public static final class f implements ClientTransportFactory {
        public final ObjectPool<Executor> a;
        public final Executor b;
        public final ObjectPool<ScheduledExecutorService> c;
        public final ScheduledExecutorService d;
        public final TransportTracer.Factory e;
        public final SocketFactory f;

        @Nullable
        public final SSLSocketFactory g;

        @Nullable
        public final HostnameVerifier h;
        public final ConnectionSpec i;
        public final int j;
        public final boolean k;
        public final long l;
        public final AtomicBackoff m;
        public final long n;
        public final int o;
        public final boolean p;
        public final int q;
        public final boolean r;
        public boolean s;

        public class a implements Runnable {
            public final AtomicBackoff.State a;

            public a(AtomicBackoff.State state) {
                this.a = state;
            }

            @Override
            public void run() {
                this.a.backoff();
            }
        }

        public f(ObjectPool objectPool, ObjectPool objectPool2, SocketFactory socketFactory, SSLSocketFactory sSLSocketFactory, HostnameVerifier hostnameVerifier, ConnectionSpec connectionSpec, int i, boolean z, long j, long j2, int i2, boolean z2, int i3, TransportTracer.Factory factory, boolean z3, a aVar) {
            this(objectPool, objectPool2, socketFactory, sSLSocketFactory, hostnameVerifier, connectionSpec, i, z, j, j2, i2, z2, i3, factory, z3);
        }

        @Override
        public void close() {
            if (this.s) {
                return;
            }
            this.s = true;
            this.a.returnObject(this.b);
            this.c.returnObject(this.d);
        }

        @Override
        public ScheduledExecutorService getScheduledExecutorService() {
            return this.d;
        }

        @Override
        public ConnectionClientTransport newClientTransport(SocketAddress socketAddress, ClientTransportFactory.ClientTransportOptions clientTransportOptions, ChannelLogger channelLogger) {
            if (this.s) {
                throw new IllegalStateException("The transport factory is closed.");
            }
            AtomicBackoff.State state = this.m.getState();
            io.grpc.okhttp.d dVar = new io.grpc.okhttp.d(this, (InetSocketAddress) socketAddress, clientTransportOptions.getAuthority(), clientTransportOptions.getUserAgent(), clientTransportOptions.getEagAttributes(), clientTransportOptions.getHttpConnectProxiedSocketAddress(), new a(state));
            if (this.k) {
                dVar.M(true, state.get(), this.n, this.p);
            }
            return dVar;
        }

        @Override
        @CheckReturnValue
        @Nullable
        public ClientTransportFactory.SwapChannelCredentialsResult swapChannelCredentials(ChannelCredentials channelCredentials) {
            g i = OkHttpChannelBuilder.i(channelCredentials);
            if (i.c != null) {
                return null;
            }
            return new ClientTransportFactory.SwapChannelCredentialsResult(new f(this.a, this.c, this.f, i.a, this.h, this.i, this.j, this.k, this.l, this.n, this.o, this.p, this.q, this.e, this.r), i.b);
        }

        public f(ObjectPool<Executor> objectPool, ObjectPool<ScheduledExecutorService> objectPool2, @Nullable SocketFactory socketFactory, @Nullable SSLSocketFactory sSLSocketFactory, @Nullable HostnameVerifier hostnameVerifier, ConnectionSpec connectionSpec, int i, boolean z, long j, long j2, int i2, boolean z2, int i3, TransportTracer.Factory factory, boolean z3) {
            this.a = objectPool;
            this.b = objectPool.getObject();
            this.c = objectPool2;
            this.d = objectPool2.getObject();
            this.f = socketFactory;
            this.g = sSLSocketFactory;
            this.h = hostnameVerifier;
            this.i = connectionSpec;
            this.j = i;
            this.k = z;
            this.l = j;
            this.m = new AtomicBackoff("keepalive time nanos", j);
            this.n = j2;
            this.o = i2;
            this.p = z2;
            this.q = i3;
            this.r = z3;
            this.e = (TransportTracer.Factory) Preconditions.checkNotNull(factory, "transportTracerFactory");
        }
    }

    public static final class g {
        public final SSLSocketFactory a;
        public final CallCredentials b;
        public final String c;

        public g(SSLSocketFactory sSLSocketFactory, CallCredentials callCredentials, String str) {
            this.a = sSLSocketFactory;
            this.b = callCredentials;
            this.c = str;
        }

        public static g a(String str) {
            return new g(null, null, (String) Preconditions.checkNotNull(str, "error"));
        }

        public static g b(SSLSocketFactory sSLSocketFactory) {
            return new g((SSLSocketFactory) Preconditions.checkNotNull(sSLSocketFactory, "factory"), null, null);
        }

        public static g c() {
            return new g(null, null, null);
        }

        public g d(CallCredentials callCredentials) {
            Preconditions.checkNotNull(callCredentials, "callCreds");
            if (this.c != null) {
                return this;
            }
            CallCredentials callCredentials2 = this.b;
            if (callCredentials2 != null) {
                callCredentials = new CompositeCallCredentials(callCredentials2, callCredentials);
            }
            return new g(this.a, callCredentials, null);
        }
    }

    static {
        a aVar = new a();
        t = aVar;
        u = SharedResourcePool.forResource(aVar);
        v = EnumSet.of(TlsChannelCredentials.Feature.MTLS, TlsChannelCredentials.Feature.CUSTOM_MANAGERS);
    }

    public OkHttpChannelBuilder(String str, int i) {
        this(GrpcUtil.authorityFromHostAndPort(str, i));
    }

    public static KeyManager[] c(byte[] bArr, byte[] bArr2) throws GeneralSecurityException {
        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bArr);
        try {
            X509Certificate[] x509Certificates = CertificateUtils.getX509Certificates(byteArrayInputStream);
            GrpcUtil.closeQuietly(byteArrayInputStream);
            byteArrayInputStream = new ByteArrayInputStream(bArr2);
            try {
                try {
                    PrivateKey privateKey = CertificateUtils.getPrivateKey(byteArrayInputStream);
                    GrpcUtil.closeQuietly(byteArrayInputStream);
                    KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
                    try {
                        keyStore.load(null, null);
                        keyStore.setKeyEntry("key", privateKey, new char[0], x509Certificates);
                        KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
                        keyManagerFactory.init(keyStore, new char[0]);
                        return keyManagerFactory.getKeyManagers();
                    } catch (IOException e2) {
                        throw new GeneralSecurityException(e2);
                    }
                } catch (IOException e3) {
                    throw new GeneralSecurityException("Unable to decode private key", e3);
                }
            } finally {
            }
        } finally {
        }
    }

    public static TrustManager[] e(byte[] bArr) throws GeneralSecurityException {
        KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
        try {
            keyStore.load(null, null);
            ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bArr);
            try {
                X509Certificate[] x509Certificates = CertificateUtils.getX509Certificates(byteArrayInputStream);
                GrpcUtil.closeQuietly(byteArrayInputStream);
                for (X509Certificate x509Certificate : x509Certificates) {
                    keyStore.setCertificateEntry(x509Certificate.getSubjectX500Principal().getName("RFC2253"), x509Certificate);
                }
                TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
                trustManagerFactory.init(keyStore);
                return trustManagerFactory.getTrustManagers();
            } catch (Throwable th) {
                GrpcUtil.closeQuietly(byteArrayInputStream);
                throw th;
            }
        } catch (IOException e2) {
            throw new GeneralSecurityException(e2);
        }
    }

    public static OkHttpChannelBuilder forAddress(String str, int i) {
        return new OkHttpChannelBuilder(str, i);
    }

    public static OkHttpChannelBuilder forTarget(String str) {
        return new OkHttpChannelBuilder(str);
    }

    public static g i(ChannelCredentials channelCredentials) {
        KeyManager[] keyManagerArr;
        TrustManager[] e2;
        if (!(channelCredentials instanceof TlsChannelCredentials)) {
            if (channelCredentials instanceof InsecureChannelCredentials) {
                return g.c();
            }
            if (channelCredentials instanceof CompositeChannelCredentials) {
                CompositeChannelCredentials compositeChannelCredentials = (CompositeChannelCredentials) channelCredentials;
                return i(compositeChannelCredentials.getChannelCredentials()).d(compositeChannelCredentials.getCallCredentials());
            }
            if (channelCredentials instanceof SslSocketFactoryChannelCredentials.b) {
                return g.b(((SslSocketFactoryChannelCredentials.b) channelCredentials).a());
            }
            if (!(channelCredentials instanceof ChoiceChannelCredentials)) {
                return g.a("Unsupported credential type: " + channelCredentials.getClass().getName());
            }
            StringBuilder sb = new StringBuilder();
            Iterator it = ((ChoiceChannelCredentials) channelCredentials).getCredentialsList().iterator();
            while (it.hasNext()) {
                g i = i((ChannelCredentials) it.next());
                if (i.c == null) {
                    return i;
                }
                sb.append(", ");
                sb.append(i.c);
            }
            return g.a(sb.substring(2));
        }
        TlsChannelCredentials tlsChannelCredentials = (TlsChannelCredentials) channelCredentials;
        Set incomprehensible = tlsChannelCredentials.incomprehensible(v);
        if (!incomprehensible.isEmpty()) {
            return g.a("TLS features not understood: " + incomprehensible);
        }
        if (tlsChannelCredentials.getKeyManagers() != null) {
            keyManagerArr = (KeyManager[]) tlsChannelCredentials.getKeyManagers().toArray(new KeyManager[0]);
        } else if (tlsChannelCredentials.getPrivateKey() == null) {
            keyManagerArr = null;
        } else {
            if (tlsChannelCredentials.getPrivateKeyPassword() != null) {
                return g.a("byte[]-based private key with password unsupported. Use unencrypted file or KeyManager");
            }
            try {
                keyManagerArr = c(tlsChannelCredentials.getCertificateChain(), tlsChannelCredentials.getPrivateKey());
            } catch (GeneralSecurityException e3) {
                q.log(Level.FINE, "Exception loading private key from credential", (Throwable) e3);
                return g.a("Unable to load private key: " + e3.getMessage());
            }
        }
        if (tlsChannelCredentials.getTrustManagers() != null) {
            e2 = (TrustManager[]) tlsChannelCredentials.getTrustManagers().toArray(new TrustManager[0]);
        } else if (tlsChannelCredentials.getRootCertificates() != null) {
            try {
                e2 = e(tlsChannelCredentials.getRootCertificates());
            } catch (GeneralSecurityException e4) {
                q.log(Level.FINE, "Exception loading root certificates from credential", (Throwable) e4);
                return g.a("Unable to load root certificates: " + e4.getMessage());
            }
        } else {
            e2 = null;
        }
        try {
            SSLContext sSLContext = SSLContext.getInstance("TLS", Platform.get().getProvider());
            sSLContext.init(keyManagerArr, e2, null);
            return g.b(sSLContext.getSocketFactory());
        } catch (GeneralSecurityException e5) {
            throw new RuntimeException("TLS Provider failure", e5);
        }
    }

    public f b() {
        return new f(this.c, this.d, this.e, d(), this.h, this.i, this.maxInboundMessageSize, this.k != Long.MAX_VALUE, this.k, this.l, this.m, this.n, this.o, this.b, false, null);
    }

    public OkHttpChannelBuilder connectionSpec(com.squareup.okhttp.ConnectionSpec connectionSpec) {
        Preconditions.checkState(!this.g, "Cannot change security when using ChannelCredentials");
        Preconditions.checkArgument(connectionSpec.isTls(), "plaintext ConnectionSpec is not accepted");
        this.i = rx5.c(connectionSpec);
        return this;
    }

    @VisibleForTesting
    @Nullable
    public SSLSocketFactory d() {
        int i = b.b[this.j.ordinal()];
        if (i == 1) {
            return null;
        }
        if (i != 2) {
            throw new RuntimeException("Unknown negotiation type: " + this.j);
        }
        try {
            if (this.f == null) {
                this.f = SSLContext.getInstance("Default", Platform.get().getProvider()).getSocketFactory();
            }
            return this.f;
        } catch (GeneralSecurityException e2) {
            throw new RuntimeException("TLS Provider failure", e2);
        }
    }

    @Override
    @Internal
    public ManagedChannelBuilder<?> delegate() {
        return this.a;
    }

    public OkHttpChannelBuilder f() {
        this.a.disableCheckAuthority();
        return this;
    }

    public OkHttpChannelBuilder flowControlWindow(int i) {
        Preconditions.checkState(i > 0, "flowControlWindow must be positive");
        this.m = i;
        return this;
    }

    public OkHttpChannelBuilder g() {
        this.a.enableCheckAuthority();
        return this;
    }

    public int h() {
        int i = b.b[this.j.ordinal()];
        if (i == 1) {
            return 80;
        }
        if (i == 2) {
            return GrpcUtil.DEFAULT_PORT_SSL;
        }
        throw new AssertionError(this.j + " not handled");
    }

    public OkHttpChannelBuilder hostnameVerifier(@Nullable HostnameVerifier hostnameVerifier) {
        Preconditions.checkState(!this.g, "Cannot change security when using ChannelCredentials");
        this.h = hostnameVerifier;
        return this;
    }

    @Deprecated
    public OkHttpChannelBuilder negotiationType(NegotiationType negotiationType) {
        Preconditions.checkState(!this.g, "Cannot change security when using ChannelCredentials");
        Preconditions.checkNotNull(negotiationType, "type");
        int i = b.a[negotiationType.ordinal()];
        if (i == 1) {
            this.j = c.TLS;
        } else {
            if (i != 2) {
                throw new AssertionError("Unknown negotiation type: " + negotiationType);
            }
            this.j = c.PLAINTEXT;
        }
        return this;
    }

    public OkHttpChannelBuilder scheduledExecutorService(ScheduledExecutorService scheduledExecutorService) {
        this.d = new FixedObjectPool((ScheduledExecutorService) Preconditions.checkNotNull(scheduledExecutorService, "scheduledExecutorService"));
        return this;
    }

    public void setStatsEnabled(boolean z) {
        this.a.setStatsEnabled(z);
    }

    public OkHttpChannelBuilder socketFactory(@Nullable SocketFactory socketFactory) {
        this.e = socketFactory;
        return this;
    }

    public OkHttpChannelBuilder sslSocketFactory(SSLSocketFactory sSLSocketFactory) {
        Preconditions.checkState(!this.g, "Cannot change security when using ChannelCredentials");
        this.f = sSLSocketFactory;
        this.j = c.TLS;
        return this;
    }

    public OkHttpChannelBuilder tlsConnectionSpec(String[] strArr, String[] strArr2) {
        Preconditions.checkState(!this.g, "Cannot change security when using ChannelCredentials");
        Preconditions.checkNotNull(strArr, "tls versions must not null");
        Preconditions.checkNotNull(strArr2, "ciphers must not null");
        this.i = new ConnectionSpec.Builder(true).supportsTlsExtensions(true).tlsVersions(strArr).cipherSuites(strArr2).build();
        return this;
    }

    public OkHttpChannelBuilder transportExecutor(@Nullable Executor executor) {
        if (executor == null) {
            this.c = u;
        } else {
            this.c = new FixedObjectPool(executor);
        }
        return this;
    }

    public OkHttpChannelBuilder(String str) {
        this.b = TransportTracer.getDefaultFactory();
        this.c = u;
        this.d = SharedResourcePool.forResource(GrpcUtil.TIMER_SERVICE);
        this.i = r;
        this.j = c.TLS;
        this.k = Long.MAX_VALUE;
        this.l = GrpcUtil.DEFAULT_KEEPALIVE_TIMEOUT_NANOS;
        this.m = 65535;
        this.o = Integer.MAX_VALUE;
        this.p = false;
        a aVar = null;
        this.a = new ManagedChannelImplBuilder(str, new e(this, aVar), new d(this, aVar));
        this.g = false;
    }

    public static OkHttpChannelBuilder forAddress(String str, int i, ChannelCredentials channelCredentials) {
        return forTarget(GrpcUtil.authorityFromHostAndPort(str, i), channelCredentials);
    }

    public static OkHttpChannelBuilder forTarget(String str, ChannelCredentials channelCredentials) {
        g i = i(channelCredentials);
        if (i.c == null) {
            return new OkHttpChannelBuilder(str, channelCredentials, i.b, i.a);
        }
        throw new IllegalArgumentException(i.c);
    }

    @Override
    public OkHttpChannelBuilder keepAliveTime(long j, TimeUnit timeUnit) {
        Preconditions.checkArgument(j > 0, "keepalive time must be positive");
        long nanos = timeUnit.toNanos(j);
        this.k = nanos;
        long clampKeepAliveTimeInNanos = KeepAliveManager.clampKeepAliveTimeInNanos(nanos);
        this.k = clampKeepAliveTimeInNanos;
        if (clampKeepAliveTimeInNanos >= s) {
            this.k = Long.MAX_VALUE;
        }
        return this;
    }

    @Override
    public OkHttpChannelBuilder keepAliveTimeout(long j, TimeUnit timeUnit) {
        Preconditions.checkArgument(j > 0, "keepalive timeout must be positive");
        long nanos = timeUnit.toNanos(j);
        this.l = nanos;
        this.l = KeepAliveManager.clampKeepAliveTimeoutInNanos(nanos);
        return this;
    }

    @Override
    public OkHttpChannelBuilder keepAliveWithoutCalls(boolean z) {
        this.n = z;
        return this;
    }

    @Override
    public OkHttpChannelBuilder maxInboundMessageSize(int i) {
        Preconditions.checkArgument(i >= 0, "negative max");
        this.maxInboundMessageSize = i;
        return this;
    }

    @Override
    public OkHttpChannelBuilder maxInboundMetadataSize(int i) {
        Preconditions.checkArgument(i > 0, "maxInboundMetadataSize must be > 0");
        this.o = i;
        return this;
    }

    @Override
    public OkHttpChannelBuilder usePlaintext() {
        Preconditions.checkState(!this.g, "Cannot change security when using ChannelCredentials");
        this.j = c.PLAINTEXT;
        return this;
    }

    @Override
    public OkHttpChannelBuilder useTransportSecurity() {
        Preconditions.checkState(!this.g, "Cannot change security when using ChannelCredentials");
        this.j = c.TLS;
        return this;
    }

    public OkHttpChannelBuilder(String str, ChannelCredentials channelCredentials, CallCredentials callCredentials, SSLSocketFactory sSLSocketFactory) {
        this.b = TransportTracer.getDefaultFactory();
        this.c = u;
        this.d = SharedResourcePool.forResource(GrpcUtil.TIMER_SERVICE);
        this.i = r;
        c cVar = c.TLS;
        this.j = cVar;
        this.k = Long.MAX_VALUE;
        this.l = GrpcUtil.DEFAULT_KEEPALIVE_TIMEOUT_NANOS;
        this.m = 65535;
        this.o = Integer.MAX_VALUE;
        this.p = false;
        a aVar = null;
        this.a = new ManagedChannelImplBuilder(str, channelCredentials, callCredentials, new e(this, aVar), new d(this, aVar));
        this.f = sSLSocketFactory;
        this.j = sSLSocketFactory == null ? c.PLAINTEXT : cVar;
        this.g = true;
    }
}