@ExperimentalApi(value="There is no plan to make this API stable, given transport API instability") public final class OkHttpChannelBuilder extends io.grpc.internal.AbstractManagedChannelImplBuilder<OkHttpChannelBuilder>
| Modifier and Type | Field and Description |
|---|---|
static ConnectionSpec |
DEFAULT_CONNECTION_SPEC |
| Modifier and Type | Method and Description |
|---|---|
protected io.grpc.internal.ClientTransportFactory |
buildTransportFactory() |
OkHttpChannelBuilder |
connectionSpec(ConnectionSpec connectionSpec)
For secure connection, provides a ConnectionSpec to specify Cipher suite and
TLS versions.
|
static OkHttpChannelBuilder |
forAddress(String host,
int port)
Creates a new builder for the given server host and port.
|
OkHttpChannelBuilder |
maxMessageSize(int maxMessageSize)
Sets the maximum message size allowed to be received on the channel.
|
OkHttpChannelBuilder |
negotiationType(NegotiationType type)
Sets the negotiation type for the HTTP/2 connection.
|
OkHttpChannelBuilder |
overrideAuthority(String authority)
Overrides the authority used with TLS and HTTP virtual hosting.
|
OkHttpChannelBuilder |
overrideHostForAuthority(String host)
Deprecated.
use
overrideAuthority(java.lang.String) instead |
OkHttpChannelBuilder |
sslSocketFactory(SSLSocketFactory factory)
Provides a SSLSocketFactory to replace the default SSLSocketFactory used for TLS.
|
OkHttpChannelBuilder |
transportExecutor(Executor transportExecutor)
Override the default executor necessary for internal transport use.
|
OkHttpChannelBuilder |
usePlaintext(boolean skipNegotiation)
Equivalent to using
negotiationType(NegotiationType) with PLAINTEXT. |
public static final ConnectionSpec DEFAULT_CONNECTION_SPEC
public static OkHttpChannelBuilder forAddress(String host, int port)
public OkHttpChannelBuilder transportExecutor(@Nullable Executor transportExecutor)
The channel does not take ownership of the given executor. It is the caller' responsibility to shutdown the executor when appropriate.
@Deprecated public OkHttpChannelBuilder overrideHostForAuthority(String host)
overrideAuthority(java.lang.String) insteadoverrideAuthority(String) in that it
appends the port number to the host provided.
Should only used by tests.
public OkHttpChannelBuilder overrideAuthority(String authority)
ManagedChannelBuilderhost:port.
Should only used by tests.
overrideAuthority in class ManagedChannelBuilder<OkHttpChannelBuilder>public OkHttpChannelBuilder negotiationType(NegotiationType type)
Default: TLS
public OkHttpChannelBuilder sslSocketFactory(SSLSocketFactory factory)
By default, when TLS is enabled, SSLSocketFactory.getDefault() will be used.
NegotiationType.TLS will be applied by calling this method.
public OkHttpChannelBuilder connectionSpec(ConnectionSpec connectionSpec)
By default DEFAULT_CONNECTION_SPEC will be used.
public OkHttpChannelBuilder maxMessageSize(int maxMessageSize)
GrpcUtil.DEFAULT_MAX_MESSAGE_SIZE.public OkHttpChannelBuilder usePlaintext(boolean skipNegotiation)
negotiationType(NegotiationType) with PLAINTEXT.usePlaintext in class ManagedChannelBuilder<OkHttpChannelBuilder>protected io.grpc.internal.ClientTransportFactory buildTransportFactory()
buildTransportFactory in class io.grpc.internal.AbstractManagedChannelImplBuilder<OkHttpChannelBuilder>