Package io.grpc.netty
Class ProtocolNegotiators
- java.lang.Object
-
- io.grpc.netty.ProtocolNegotiators
-
final class ProtocolNegotiators extends java.lang.Object
CommonProtocolNegotiator
s used by gRPC.
-
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description private static java.util.logging.Logger
log
private static java.util.EnumSet<TlsServerCredentials.Feature>
understoodServerTlsFeatures
private static java.util.EnumSet<TlsChannelCredentials.Feature>
understoodTlsFeatures
-
Constructor Summary
Constructors Modifier Constructor Description private
ProtocolNegotiators()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ProtocolNegotiator.ServerFactory
fixedServerFactory(ProtocolNegotiator negotiator)
static ProtocolNegotiators.FromChannelCredentialsResult
from(ChannelCredentials creds)
static ProtocolNegotiators.FromServerCredentialsResult
from(ServerCredentials creds)
static ProtocolNegotiator
httpProxy(java.net.SocketAddress proxyAddress, java.lang.String proxyUsername, java.lang.String proxyPassword, ProtocolNegotiator negotiator)
Returns aProtocolNegotiator
that does HTTP CONNECT proxy negotiation.(package private) static void
logSslEngineDetails(java.util.logging.Level level, io.netty.channel.ChannelHandlerContext ctx, java.lang.String msg, java.lang.Throwable t)
(package private) static ProtocolNegotiators.HostPort
parseAuthority(java.lang.String authority)
static ProtocolNegotiator
plaintext()
Returns aChannelHandler
that ensures that thehandler
is added to the pipeline writes to theChannel
may happen immediately, even before it is active.static ProtocolNegotiator.ClientFactory
plaintextClientFactory()
static ProtocolNegotiator
plaintextUpgrade()
Returns aProtocolNegotiator
used for upgrading to HTTP/2 from HTTP/1.x.static ProtocolNegotiator.ClientFactory
plaintextUpgradeClientFactory()
static ProtocolNegotiator
serverPlaintext()
Create a server plaintext handler for gRPC.static ProtocolNegotiator.ServerFactory
serverPlaintextFactory()
Create a server plaintext handler factory for gRPC.static ProtocolNegotiator
serverTls(io.netty.handler.ssl.SslContext sslContext)
Create a server TLS handler for HTTP/2 capable of using ALPN/NPN.static ProtocolNegotiator
serverTls(io.netty.handler.ssl.SslContext sslContext, ObjectPool<? extends java.util.concurrent.Executor> executorPool)
Create a server TLS handler for HTTP/2 capable of using ALPN/NPN.static ProtocolNegotiator.ServerFactory
serverTlsFactory(io.netty.handler.ssl.SslContext sslContext)
static ProtocolNegotiator
tls(io.netty.handler.ssl.SslContext sslContext)
Returns aProtocolNegotiator
that ensures the pipeline is set up so that TLS will be negotiated, thehandler
is added and writes to theChannel
may happen immediately, even before the TLS Handshake is complete.static ProtocolNegotiator
tls(io.netty.handler.ssl.SslContext sslContext, ObjectPool<? extends java.util.concurrent.Executor> executorPool, java.util.Optional<java.lang.Runnable> handshakeCompleteRunnable)
Returns aProtocolNegotiator
that ensures the pipeline is set up so that TLS will be negotiated, thehandler
is added and writes to theChannel
may happen immediately, even before the TLS Handshake is complete.static ProtocolNegotiator.ClientFactory
tlsClientFactory(io.netty.handler.ssl.SslContext sslContext)
private static java.lang.RuntimeException
unavailableException(java.lang.String msg)
-
-
-
Field Detail
-
log
private static final java.util.logging.Logger log
-
understoodTlsFeatures
private static final java.util.EnumSet<TlsChannelCredentials.Feature> understoodTlsFeatures
-
understoodServerTlsFeatures
private static final java.util.EnumSet<TlsServerCredentials.Feature> understoodServerTlsFeatures
-
-
Method Detail
-
from
public static ProtocolNegotiators.FromChannelCredentialsResult from(ChannelCredentials creds)
-
from
public static ProtocolNegotiators.FromServerCredentialsResult from(ServerCredentials creds)
-
fixedServerFactory
public static ProtocolNegotiator.ServerFactory fixedServerFactory(ProtocolNegotiator negotiator)
-
serverPlaintext
public static ProtocolNegotiator serverPlaintext()
Create a server plaintext handler for gRPC.
-
serverPlaintextFactory
public static ProtocolNegotiator.ServerFactory serverPlaintextFactory()
Create a server plaintext handler factory for gRPC.
-
serverTlsFactory
public static ProtocolNegotiator.ServerFactory serverTlsFactory(io.netty.handler.ssl.SslContext sslContext)
-
serverTls
public static ProtocolNegotiator serverTls(io.netty.handler.ssl.SslContext sslContext, ObjectPool<? extends java.util.concurrent.Executor> executorPool)
Create a server TLS handler for HTTP/2 capable of using ALPN/NPN.- Parameters:
executorPool
- a dedicatedExecutor
pool for time-consuming TLS tasks
-
serverTls
public static ProtocolNegotiator serverTls(io.netty.handler.ssl.SslContext sslContext)
Create a server TLS handler for HTTP/2 capable of using ALPN/NPN.
-
httpProxy
public static ProtocolNegotiator httpProxy(java.net.SocketAddress proxyAddress, @Nullable java.lang.String proxyUsername, @Nullable java.lang.String proxyPassword, ProtocolNegotiator negotiator)
Returns aProtocolNegotiator
that does HTTP CONNECT proxy negotiation.
-
parseAuthority
static ProtocolNegotiators.HostPort parseAuthority(java.lang.String authority)
-
tls
public static ProtocolNegotiator tls(io.netty.handler.ssl.SslContext sslContext, ObjectPool<? extends java.util.concurrent.Executor> executorPool, java.util.Optional<java.lang.Runnable> handshakeCompleteRunnable)
Returns aProtocolNegotiator
that ensures the pipeline is set up so that TLS will be negotiated, thehandler
is added and writes to theChannel
may happen immediately, even before the TLS Handshake is complete.- Parameters:
executorPool
- a dedicatedExecutor
pool for time-consuming TLS tasks
-
tls
public static ProtocolNegotiator tls(io.netty.handler.ssl.SslContext sslContext)
Returns aProtocolNegotiator
that ensures the pipeline is set up so that TLS will be negotiated, thehandler
is added and writes to theChannel
may happen immediately, even before the TLS Handshake is complete.
-
tlsClientFactory
public static ProtocolNegotiator.ClientFactory tlsClientFactory(io.netty.handler.ssl.SslContext sslContext)
-
plaintextUpgrade
public static ProtocolNegotiator plaintextUpgrade()
Returns aProtocolNegotiator
used for upgrading to HTTP/2 from HTTP/1.x.
-
plaintextUpgradeClientFactory
public static ProtocolNegotiator.ClientFactory plaintextUpgradeClientFactory()
-
plaintext
public static ProtocolNegotiator plaintext()
Returns aChannelHandler
that ensures that thehandler
is added to the pipeline writes to theChannel
may happen immediately, even before it is active.
-
plaintextClientFactory
public static ProtocolNegotiator.ClientFactory plaintextClientFactory()
-
unavailableException
private static java.lang.RuntimeException unavailableException(java.lang.String msg)
-
logSslEngineDetails
static void logSslEngineDetails(java.util.logging.Level level, io.netty.channel.ChannelHandlerContext ctx, java.lang.String msg, @Nullable java.lang.Throwable t)
-
-