Package io.grpc.netty
Class ProtocolNegotiators
- java.lang.Object
-
- io.grpc.netty.ProtocolNegotiators
-
final class ProtocolNegotiators extends java.lang.ObjectCommonProtocolNegotiators used by gRPC.
-
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description private static java.util.logging.Loggerlogprivate static java.util.EnumSet<TlsServerCredentials.Feature>understoodServerTlsFeaturesprivate static java.util.EnumSet<TlsChannelCredentials.Feature>understoodTlsFeatures
-
Constructor Summary
Constructors Modifier Constructor Description privateProtocolNegotiators()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ProtocolNegotiator.ServerFactoryfixedServerFactory(ProtocolNegotiator negotiator)static ProtocolNegotiators.FromChannelCredentialsResultfrom(ChannelCredentials creds)static ProtocolNegotiators.FromServerCredentialsResultfrom(ServerCredentials creds)static ProtocolNegotiatorhttpProxy(java.net.SocketAddress proxyAddress, java.lang.String proxyUsername, java.lang.String proxyPassword, ProtocolNegotiator negotiator)Returns aProtocolNegotiatorthat does HTTP CONNECT proxy negotiation.(package private) static voidlogSslEngineDetails(java.util.logging.Level level, io.netty.channel.ChannelHandlerContext ctx, java.lang.String msg, java.lang.Throwable t)(package private) static ProtocolNegotiators.HostPortparseAuthority(java.lang.String authority)static ProtocolNegotiatorplaintext()Returns aChannelHandlerthat ensures that thehandleris added to the pipeline writes to theChannelmay happen immediately, even before it is active.static ProtocolNegotiator.ClientFactoryplaintextClientFactory()static ProtocolNegotiatorplaintextUpgrade()Returns aProtocolNegotiatorused for upgrading to HTTP/2 from HTTP/1.x.static ProtocolNegotiator.ClientFactoryplaintextUpgradeClientFactory()static ProtocolNegotiatorserverPlaintext()Create a server plaintext handler for gRPC.static ProtocolNegotiator.ServerFactoryserverPlaintextFactory()Create a server plaintext handler factory for gRPC.static ProtocolNegotiatorserverTls(io.netty.handler.ssl.SslContext sslContext)Create a server TLS handler for HTTP/2 capable of using ALPN/NPN.static ProtocolNegotiatorserverTls(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.ServerFactoryserverTlsFactory(io.netty.handler.ssl.SslContext sslContext)static ProtocolNegotiatortls(io.netty.handler.ssl.SslContext sslContext)Returns aProtocolNegotiatorthat ensures the pipeline is set up so that TLS will be negotiated, thehandleris added and writes to theChannelmay happen immediately, even before the TLS Handshake is complete.static ProtocolNegotiatortls(io.netty.handler.ssl.SslContext sslContext, ObjectPool<? extends java.util.concurrent.Executor> executorPool, java.util.Optional<java.lang.Runnable> handshakeCompleteRunnable)Returns aProtocolNegotiatorthat ensures the pipeline is set up so that TLS will be negotiated, thehandleris added and writes to theChannelmay happen immediately, even before the TLS Handshake is complete.static ProtocolNegotiator.ClientFactorytlsClientFactory(io.netty.handler.ssl.SslContext sslContext)private static java.lang.RuntimeExceptionunavailableException(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 dedicatedExecutorpool 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 aProtocolNegotiatorthat 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 aProtocolNegotiatorthat ensures the pipeline is set up so that TLS will be negotiated, thehandleris added and writes to theChannelmay happen immediately, even before the TLS Handshake is complete.- Parameters:
executorPool- a dedicatedExecutorpool for time-consuming TLS tasks
-
tls
public static ProtocolNegotiator tls(io.netty.handler.ssl.SslContext sslContext)
Returns aProtocolNegotiatorthat ensures the pipeline is set up so that TLS will be negotiated, thehandleris added and writes to theChannelmay 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 aProtocolNegotiatorused for upgrading to HTTP/2 from HTTP/1.x.
-
plaintextUpgradeClientFactory
public static ProtocolNegotiator.ClientFactory plaintextUpgradeClientFactory()
-
plaintext
public static ProtocolNegotiator plaintext()
Returns aChannelHandlerthat ensures that thehandleris added to the pipeline writes to theChannelmay 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)
-
-