Class ClientConnectionHandler

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

    public class ClientConnectionHandler
    extends ThreeWayHandshakeClientHandler<JoinMessage,​WelcomeMessage>
    This handler performs the handshake with the server and processes incoming messages during the session.

    The handshake is initiated by a JoinMessage sent by the client, which is answered with a WelcomeMessage from the server. The client must then confirm this message with a SuccessMessage.

    • Field Detail

      • timeout

        protected final Duration timeout
      • pipeline

        protected final Pipeline pipeline
      • networkId

        protected final int networkId
      • identity

        protected final Identity identity
      • timeoutFuture

        protected io.netty.util.concurrent.ScheduledFuture<?> timeoutFuture
    • Constructor Detail

      • ClientConnectionHandler

        public ClientConnectionHandler​(ClientEnvironment environment)
    • Method Detail

      • getLogger

        protected org.slf4j.Logger getLogger()
      • processUnexpectedMessageDuringHandshake

        protected void processUnexpectedMessageDuringHandshake​(io.netty.channel.ChannelHandlerContext ctx,
                                                               Message message)
      • processMessageAfterHandshake

        protected void processMessageAfterHandshake​(io.netty.channel.ChannelHandlerContext ctx,
                                                    Message message)
      • channelActive

        public void channelActive​(io.netty.channel.ChannelHandlerContext ctx)
                           throws Exception
        Specified by:
        channelActive in interface io.netty.channel.ChannelInboundHandler
        Overrides:
        channelActive in class io.netty.channel.ChannelInboundHandlerAdapter
        Throws:
        Exception
      • startTimeoutGuard

        protected void startTimeoutGuard​(io.netty.channel.ChannelHandlerContext ctx)
      • rejectSession

        protected void rejectSession​(io.netty.channel.ChannelHandlerContext ctx,
                                     String error)
      • exceptionCaught

        public void exceptionCaught​(io.netty.channel.ChannelHandlerContext ctx,
                                    Throwable cause)
        Specified by:
        exceptionCaught in interface io.netty.channel.ChannelHandler
        Specified by:
        exceptionCaught in interface io.netty.channel.ChannelInboundHandler
        Overrides:
        exceptionCaught in class io.netty.channel.ChannelInboundHandlerAdapter