Class DefaultSessionInitializer

  • All Implemented Interfaces:
    io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler
    Direct Known Subclasses:
    ClientChannelInitializer, ServerChannelInitializer

    public abstract class DefaultSessionInitializer
    extends io.netty.channel.ChannelInitializer<io.netty.channel.socket.SocketChannel>
    Creates a newly configured ChannelPipeline for a new channel for a connection to or from a the Server.

    Note: You have to add a websocket handler by yourself to the beforeMarshalStage(ChannelPipeline)

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

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

      Fields 
      Modifier and Type Field Description
      static String IDLE_EVENT  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected DefaultSessionInitializer​(int networkId, Identity identity, int flushBufferSize, Duration readIdleTimeout, short pingPongRetries)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void afterBufferStage​(io.netty.channel.ChannelPipeline pipeline)  
      protected void afterExceptionStage​(io.netty.channel.ChannelPipeline pipeline)
      Adds ChannelHandler to the ChannelPipeline, after the default ExceptionHandler has taken place.
      protected void afterFilterStage​(io.netty.channel.ChannelPipeline pipeline)  
      protected void afterIdleStage​(io.netty.channel.ChannelPipeline pipeline)  
      protected void afterMarshalStage​(io.netty.channel.ChannelPipeline pipeline)  
      protected void afterPojoMarshalStage​(io.netty.channel.ChannelPipeline pipeline)  
      protected void afterSslStage​(io.netty.channel.socket.SocketChannel ch)  
      protected void beforeBufferStage​(io.netty.channel.ChannelPipeline pipeline)  
      protected void beforeExceptionStage​(io.netty.channel.ChannelPipeline pipeline)  
      protected void beforeFilterStage​(io.netty.channel.ChannelPipeline pipeline)  
      protected void beforeIdleStage​(io.netty.channel.ChannelPipeline pipeline)  
      protected abstract void beforeMarshalStage​(io.netty.channel.ChannelPipeline pipeline)  
      protected void beforePojoMarshalStage​(io.netty.channel.ChannelPipeline pipeline)  
      protected void beforeSslStage​(io.netty.channel.socket.SocketChannel ch)  
      protected void bufferStage​(io.netty.channel.ChannelPipeline pipeline)
      Adds ChannelHandler for buffer strategies to the ChannelPipeline.
      protected abstract void customStage​(io.netty.channel.ChannelPipeline pipeline)
      Adds ChannelHandler to the ChannelPipeline, after the default initialization has taken place.
      protected void exceptionStage​(io.netty.channel.ChannelPipeline pipeline)
      Adds ChannelHandler for exception handling to the ChannelPipeline.
      protected void filterStage​(io.netty.channel.ChannelPipeline pipeline)
      Adds ChannelHandler for filtering to the ChannelPipeline.
      protected abstract io.netty.handler.ssl.SslHandler generateSslContext​(io.netty.channel.socket.SocketChannel ch)
      Generates a SslHandler that can be added to the ChannelPipeline.
      protected void idleStage​(io.netty.channel.ChannelPipeline pipeline)
      Adds ChannelHandler for idle handling to the ChannelPipeline.
      protected void initChannel​(io.netty.channel.socket.SocketChannel ch)  
      protected void marshalStage​(io.netty.channel.ChannelPipeline pipeline)
      Adds ChannelHandler for marshalling to the ChannelPipeline.
      protected void pojoMarshalStage​(io.netty.channel.ChannelPipeline pipeline)
      Adds ChannelHandler for POJO marshalling handling to the ChannelPipeline.
      protected void sslStage​(io.netty.channel.socket.SocketChannel ch)
      At this stage the SslHandler is added to the pipeline.
      • Methods inherited from class io.netty.channel.ChannelInitializer

        channelRegistered, exceptionCaught, handlerAdded, handlerRemoved
      • Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

        channelActive, channelInactive, channelRead, channelReadComplete, channelUnregistered, channelWritabilityChanged, userEventTriggered
      • Methods inherited from class io.netty.channel.ChannelHandlerAdapter

        ensureNotSharable, isSharable
    • Constructor Detail

      • DefaultSessionInitializer

        protected DefaultSessionInitializer​(int networkId,
                                            Identity identity,
                                            int flushBufferSize,
                                            Duration readIdleTimeout,
                                            short pingPongRetries)
    • Method Detail

      • initChannel

        protected void initChannel​(io.netty.channel.socket.SocketChannel ch)
                            throws DrasylException
        Specified by:
        initChannel in class io.netty.channel.ChannelInitializer<io.netty.channel.socket.SocketChannel>
        Throws:
        DrasylException
      • beforeSslStage

        protected void beforeSslStage​(io.netty.channel.socket.SocketChannel ch)
      • sslStage

        protected void sslStage​(io.netty.channel.socket.SocketChannel ch)
                         throws DrasylException
        At this stage the SslHandler is added to the pipeline.
        Parameters:
        ch - the SocketChannel
        Throws:
        DrasylException
      • afterSslStage

        protected void afterSslStage​(io.netty.channel.socket.SocketChannel ch)
      • beforeBufferStage

        protected void beforeBufferStage​(io.netty.channel.ChannelPipeline pipeline)
      • bufferStage

        protected void bufferStage​(io.netty.channel.ChannelPipeline pipeline)
        Adds ChannelHandler for buffer strategies to the ChannelPipeline.
        Parameters:
        pipeline - the ChannelPipeline
      • afterBufferStage

        protected void afterBufferStage​(io.netty.channel.ChannelPipeline pipeline)
      • beforeMarshalStage

        protected abstract void beforeMarshalStage​(io.netty.channel.ChannelPipeline pipeline)
      • marshalStage

        protected void marshalStage​(io.netty.channel.ChannelPipeline pipeline)
        Adds ChannelHandler for marshalling to the ChannelPipeline.
        Parameters:
        pipeline - the ChannelPipeline
      • afterMarshalStage

        protected void afterMarshalStage​(io.netty.channel.ChannelPipeline pipeline)
      • beforeFilterStage

        protected void beforeFilterStage​(io.netty.channel.ChannelPipeline pipeline)
      • filterStage

        protected void filterStage​(io.netty.channel.ChannelPipeline pipeline)
        Adds ChannelHandler for filtering to the ChannelPipeline.
        Parameters:
        pipeline - the ChannelPipeline
      • afterFilterStage

        protected void afterFilterStage​(io.netty.channel.ChannelPipeline pipeline)
      • beforePojoMarshalStage

        protected void beforePojoMarshalStage​(io.netty.channel.ChannelPipeline pipeline)
      • pojoMarshalStage

        protected void pojoMarshalStage​(io.netty.channel.ChannelPipeline pipeline)
        Adds ChannelHandler for POJO marshalling handling to the ChannelPipeline.
        Parameters:
        pipeline - the ChannelPipeline
      • afterPojoMarshalStage

        protected void afterPojoMarshalStage​(io.netty.channel.ChannelPipeline pipeline)
      • beforeIdleStage

        protected void beforeIdleStage​(io.netty.channel.ChannelPipeline pipeline)
      • idleStage

        protected void idleStage​(io.netty.channel.ChannelPipeline pipeline)
        Adds ChannelHandler for idle handling to the ChannelPipeline.
        Parameters:
        pipeline - the ChannelPipeline
      • afterIdleStage

        protected void afterIdleStage​(io.netty.channel.ChannelPipeline pipeline)
      • customStage

        protected abstract void customStage​(io.netty.channel.ChannelPipeline pipeline)
        Adds ChannelHandler to the ChannelPipeline, after the default initialization has taken place.
        Parameters:
        pipeline - the ChannelPipeline
      • beforeExceptionStage

        protected void beforeExceptionStage​(io.netty.channel.ChannelPipeline pipeline)
      • exceptionStage

        protected void exceptionStage​(io.netty.channel.ChannelPipeline pipeline)
        Adds ChannelHandler for exception handling to the ChannelPipeline.
        Parameters:
        pipeline - the ChannelPipeline
      • afterExceptionStage

        protected void afterExceptionStage​(io.netty.channel.ChannelPipeline pipeline)
        Adds ChannelHandler to the ChannelPipeline, after the default ExceptionHandler has taken place.
        Parameters:
        pipeline - the ChannelPipeline
      • generateSslContext

        protected abstract io.netty.handler.ssl.SslHandler generateSslContext​(io.netty.channel.socket.SocketChannel ch)
                                                                       throws DrasylException
        Generates a SslHandler that can be added to the ChannelPipeline. If this method returns null, the SslHandler is not added to the ChannelPipeline.
        Parameters:
        ch - the SocketChannel to initialize a SslHandler
        Returns:
        SslHandler or null
        Throws:
        DrasylException