Package org.drasyl.peer.connection
Class DefaultSessionInitializer
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelInitializer<io.netty.channel.socket.SocketChannel>
org.drasyl.peer.connection.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 -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefaultSessionInitializer(int networkId, Identity identity, int flushBufferSize, Duration readIdleTimeout, short pingPongRetries) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafterBufferStage(io.netty.channel.ChannelPipeline pipeline) protected voidafterExceptionStage(io.netty.channel.ChannelPipeline pipeline) protected voidafterFilterStage(io.netty.channel.ChannelPipeline pipeline) protected voidafterIdleStage(io.netty.channel.ChannelPipeline pipeline) protected voidafterMarshalStage(io.netty.channel.ChannelPipeline pipeline) protected voidafterPojoMarshalStage(io.netty.channel.ChannelPipeline pipeline) protected voidafterSslStage(io.netty.channel.socket.SocketChannel ch) protected voidbeforeBufferStage(io.netty.channel.ChannelPipeline pipeline) protected voidbeforeExceptionStage(io.netty.channel.ChannelPipeline pipeline) protected voidbeforeFilterStage(io.netty.channel.ChannelPipeline pipeline) protected voidbeforeIdleStage(io.netty.channel.ChannelPipeline pipeline) protected abstract voidbeforeMarshalStage(io.netty.channel.ChannelPipeline pipeline) protected voidbeforePojoMarshalStage(io.netty.channel.ChannelPipeline pipeline) protected voidbeforeSslStage(io.netty.channel.socket.SocketChannel ch) protected voidbufferStage(io.netty.channel.ChannelPipeline pipeline) AddsChannelHandlerfor buffer strategies to theChannelPipeline.protected abstract voidcustomStage(io.netty.channel.ChannelPipeline pipeline) AddsChannelHandlerto theChannelPipeline, after the default initialization has taken place.protected voidexceptionStage(io.netty.channel.ChannelPipeline pipeline) AddsChannelHandlerfor exception handling to theChannelPipeline.protected voidfilterStage(io.netty.channel.ChannelPipeline pipeline) AddsChannelHandlerfor filtering to theChannelPipeline.protected abstract io.netty.handler.ssl.SslHandlergenerateSslContext(io.netty.channel.socket.SocketChannel ch) Generates aSslHandlerthat can be added to theChannelPipeline.protected voididleStage(io.netty.channel.ChannelPipeline pipeline) AddsChannelHandlerfor idle handling to theChannelPipeline.protected voidinitChannel(io.netty.channel.socket.SocketChannel ch) protected voidmarshalStage(io.netty.channel.ChannelPipeline pipeline) AddsChannelHandlerfor marshalling to theChannelPipeline.protected voidpojoMarshalStage(io.netty.channel.ChannelPipeline pipeline) AddsChannelHandlerfor POJO marshalling handling to theChannelPipeline.protected voidsslStage(io.netty.channel.socket.SocketChannel ch) At this stage theSslHandleris added to the pipeline.Methods inherited from class io.netty.channel.ChannelInitializer
channelRegistered, exceptionCaught, handlerAdded, handlerRemovedMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelRead, channelReadComplete, channelUnregistered, channelWritabilityChanged, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, isSharable
-
Field Details
-
IDLE_EVENT
- See Also:
-
-
Constructor Details
-
DefaultSessionInitializer
-
-
Method Details
-
initChannel
- Specified by:
initChannelin classio.netty.channel.ChannelInitializer<io.netty.channel.socket.SocketChannel>- Throws:
DrasylException
-
beforeSslStage
protected void beforeSslStage(io.netty.channel.socket.SocketChannel ch) -
sslStage
At this stage theSslHandleris added to the pipeline.- Parameters:
ch- theSocketChannel- 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) AddsChannelHandlerfor buffer strategies to theChannelPipeline.- Parameters:
pipeline- theChannelPipeline
-
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) AddsChannelHandlerfor marshalling to theChannelPipeline.- Parameters:
pipeline- theChannelPipeline
-
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) AddsChannelHandlerfor filtering to theChannelPipeline.- Parameters:
pipeline- theChannelPipeline
-
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) AddsChannelHandlerfor POJO marshalling handling to theChannelPipeline.- Parameters:
pipeline- theChannelPipeline
-
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) AddsChannelHandlerfor idle handling to theChannelPipeline.- Parameters:
pipeline- theChannelPipeline
-
afterIdleStage
protected void afterIdleStage(io.netty.channel.ChannelPipeline pipeline) -
customStage
protected abstract void customStage(io.netty.channel.ChannelPipeline pipeline) AddsChannelHandlerto theChannelPipeline, after the default initialization has taken place.- Parameters:
pipeline- theChannelPipeline
-
beforeExceptionStage
protected void beforeExceptionStage(io.netty.channel.ChannelPipeline pipeline) -
exceptionStage
protected void exceptionStage(io.netty.channel.ChannelPipeline pipeline) AddsChannelHandlerfor exception handling to theChannelPipeline.- Parameters:
pipeline- theChannelPipeline
-
afterExceptionStage
protected void afterExceptionStage(io.netty.channel.ChannelPipeline pipeline) - Parameters:
pipeline- theChannelPipeline
-
generateSslContext
protected abstract io.netty.handler.ssl.SslHandler generateSslContext(io.netty.channel.socket.SocketChannel ch) throws DrasylException Generates aSslHandlerthat can be added to theChannelPipeline. If this method returnsnull, the SslHandler is not added to theChannelPipeline.- Parameters:
ch- theSocketChannelto initialize aSslHandler- Returns:
SslHandlerornull- Throws:
DrasylException
-