Package io.grpc.netty

Class ProtocolNegotiators


  • final class ProtocolNegotiators
    extends java.lang.Object
    Common ProtocolNegotiators used by gRPC.
    • Field Detail

      • log

        private static final java.util.logging.Logger log
    • Constructor Detail

      • ProtocolNegotiators

        private ProtocolNegotiators()
    • Method Detail

      • serverPlaintext

        public static ProtocolNegotiator serverPlaintext()
        Create a server plaintext handler for gRPC.
      • 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 dedicated Executor 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 a ProtocolNegotiator that does HTTP CONNECT proxy negotiation.
      • 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 a ProtocolNegotiator that ensures the pipeline is set up so that TLS will be negotiated, the handler is added and writes to the Channel may happen immediately, even before the TLS Handshake is complete.
        Parameters:
        executorPool - a dedicated Executor pool for time-consuming TLS tasks
      • tls

        public static ProtocolNegotiator tls​(io.netty.handler.ssl.SslContext sslContext)
        Returns a ProtocolNegotiator that ensures the pipeline is set up so that TLS will be negotiated, the handler is added and writes to the Channel may happen immediately, even before the TLS Handshake is complete.
      • plaintext

        public static ProtocolNegotiator plaintext()
        Returns a ChannelHandler that ensures that the handler is added to the pipeline writes to the Channel may happen immediately, even before it is active.
      • 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)