Class TsiHandshakeHandler

  • All Implemented Interfaces:
    io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

    public final class TsiHandshakeHandler
    extends io.netty.handler.codec.ByteToMessageDecoder
    Performs The TSI Handshake.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  TsiHandshakeHandler.HandshakeValidator
      Validates a Tsi Peer object.
      • Nested classes/interfaces inherited from class io.netty.handler.codec.ByteToMessageDecoder

        io.netty.handler.codec.ByteToMessageDecoder.Cumulator
      • Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

        io.netty.channel.ChannelHandler.Sharable
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void decode​(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, java.util.List<java.lang.Object> out)  
      protected void decodeLast​(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, java.util.List<java.lang.Object> out)  
      private void fireProtocolNegotiationEvent​(io.netty.channel.ChannelHandlerContext ctx, TsiPeer peer, java.lang.Object authContext, TsiHandshakeHandler.HandshakeValidator.SecurityDetails details)  
      protected void handlerRemoved0​(io.netty.channel.ChannelHandlerContext ctx)  
      private io.netty.channel.ChannelFuture semaphoreAcquire​(io.netty.channel.ChannelHandlerContext ctx)  
      private void semaphoreRelease()  
      private void sendHandshake​(io.netty.channel.ChannelHandlerContext ctx)
      Sends as many bytes as are available from the handshaker to the remote peer.
      void userEventTriggered​(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object evt)  
      • Methods inherited from class io.netty.handler.codec.ByteToMessageDecoder

        actualReadableBytes, callDecode, channelInactive, channelRead, channelReadComplete, discardSomeReadBytes, handlerRemoved, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode
      • Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

        channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught
      • Methods inherited from class io.netty.channel.ChannelHandlerAdapter

        ensureNotSharable, handlerAdded, isSharable
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface io.netty.channel.ChannelHandler

        handlerAdded
    • Field Detail

      • next

        private final io.netty.channel.ChannelHandler next
      • pne

        private io.grpc.netty.ProtocolNegotiationEvent pne
      • semaphoreAcquired

        private boolean semaphoreAcquired
      • negotiationLogger

        private final io.grpc.ChannelLogger negotiationLogger
    • Constructor Detail

      • TsiHandshakeHandler

        public TsiHandshakeHandler​(io.netty.channel.ChannelHandler next,
                                   NettyTsiHandshaker handshaker,
                                   TsiHandshakeHandler.HandshakeValidator handshakeValidator,
                                   AsyncSemaphore semaphore,
                                   io.grpc.ChannelLogger negotiationLogger)
        Constructs a TsHandshakeHandler. If a semaphore is provided, a permit from the semaphore is required to start the handshake and is returned when the handshake ends.
    • Method Detail

      • decodeLast

        protected void decodeLast​(io.netty.channel.ChannelHandlerContext ctx,
                                  io.netty.buffer.ByteBuf in,
                                  java.util.List<java.lang.Object> out)
                           throws java.lang.Exception
        Overrides:
        decodeLast in class io.netty.handler.codec.ByteToMessageDecoder
        Throws:
        java.lang.Exception
      • decode

        protected void decode​(io.netty.channel.ChannelHandlerContext ctx,
                              io.netty.buffer.ByteBuf in,
                              java.util.List<java.lang.Object> out)
                       throws java.lang.Exception
        Specified by:
        decode in class io.netty.handler.codec.ByteToMessageDecoder
        Throws:
        java.lang.Exception
      • userEventTriggered

        public void userEventTriggered​(io.netty.channel.ChannelHandlerContext ctx,
                                       java.lang.Object evt)
                                throws java.lang.Exception
        Specified by:
        userEventTriggered in interface io.netty.channel.ChannelInboundHandler
        Overrides:
        userEventTriggered in class io.netty.handler.codec.ByteToMessageDecoder
        Throws:
        java.lang.Exception
      • sendHandshake

        private void sendHandshake​(io.netty.channel.ChannelHandlerContext ctx)
                            throws java.security.GeneralSecurityException
        Sends as many bytes as are available from the handshaker to the remote peer.
        Throws:
        java.security.GeneralSecurityException
      • handlerRemoved0

        protected void handlerRemoved0​(io.netty.channel.ChannelHandlerContext ctx)
                                throws java.lang.Exception
        Overrides:
        handlerRemoved0 in class io.netty.handler.codec.ByteToMessageDecoder
        Throws:
        java.lang.Exception
      • semaphoreAcquire

        private io.netty.channel.ChannelFuture semaphoreAcquire​(io.netty.channel.ChannelHandlerContext ctx)
      • semaphoreRelease

        private void semaphoreRelease()