Class ServerConnectionHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<I>
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler, io.netty.channel.ChannelOutboundHandler

public class ServerConnectionHandler extends ThreeWayHandshakeServerHandler<JoinMessage,WelcomeMessage>
Acts as a guard for in- and outbound connections. A channel is only created, when a JoinMessage was received. Outgoing messages are dropped unless a JoinMessage was received. Every other incoming message is also dropped unless a JoinMessage was received.

If a JoinMessage was not received in DrasylConfig.getServerHandshakeTimeout() the connection will be closed.

This handler closes the channel if an exception occurs before a JoinMessage has been received.