Search in sources :

Example 1 with ClientConnectionHandler

use of org.terasology.engine.network.internal.ClientConnectionHandler in project Terasology by MovingBlocks.

the class TerasologyClientPipelineFactory method initChannel.

@Override
protected void initChannel(Channel ch) throws Exception {
    JoinStatusImpl joinStatus = new JoinStatusImpl();
    ChannelPipeline p = ch.pipeline();
    p.addLast(MetricRecordingHandler.NAME, new MetricRecordingHandler());
    p.addLast("inflateDecoder", new Lz4FrameDecoder());
    p.addLast("lengthFrameDecoder", new LengthFieldBasedFrameDecoder(8388608, 0, 3, 0, 3));
    p.addLast("protobufDecoder", new ProtobufDecoder(NetData.NetMessage.getDefaultInstance()));
    p.addLast("deflateEncoder", new Lz4FrameEncoder(true));
    p.addLast("frameLengthEncoder", new LengthFieldPrepender(3));
    p.addLast("protobufEncoder", new ProtobufEncoder());
    p.addLast("authenticationHandler", new ClientHandshakeHandler(joinStatus));
    p.addLast("connectionHandler", new ClientConnectionHandler(joinStatus, networkSystem));
    p.addLast("handler", new ClientHandler(networkSystem));
}
Also used : Lz4FrameEncoder(io.netty.handler.codec.compression.Lz4FrameEncoder) ProtobufEncoder(io.netty.handler.codec.protobuf.ProtobufEncoder) ClientHandshakeHandler(org.terasology.engine.network.internal.ClientHandshakeHandler) MetricRecordingHandler(org.terasology.engine.network.internal.MetricRecordingHandler) ProtobufDecoder(io.netty.handler.codec.protobuf.ProtobufDecoder) ClientHandler(org.terasology.engine.network.internal.ClientHandler) ClientConnectionHandler(org.terasology.engine.network.internal.ClientConnectionHandler) LengthFieldPrepender(io.netty.handler.codec.LengthFieldPrepender) LengthFieldBasedFrameDecoder(io.netty.handler.codec.LengthFieldBasedFrameDecoder) JoinStatusImpl(org.terasology.engine.network.internal.JoinStatusImpl) ChannelPipeline(io.netty.channel.ChannelPipeline) Lz4FrameDecoder(io.netty.handler.codec.compression.Lz4FrameDecoder)

Aggregations

ChannelPipeline (io.netty.channel.ChannelPipeline)1 LengthFieldBasedFrameDecoder (io.netty.handler.codec.LengthFieldBasedFrameDecoder)1 LengthFieldPrepender (io.netty.handler.codec.LengthFieldPrepender)1 Lz4FrameDecoder (io.netty.handler.codec.compression.Lz4FrameDecoder)1 Lz4FrameEncoder (io.netty.handler.codec.compression.Lz4FrameEncoder)1 ProtobufDecoder (io.netty.handler.codec.protobuf.ProtobufDecoder)1 ProtobufEncoder (io.netty.handler.codec.protobuf.ProtobufEncoder)1 ClientConnectionHandler (org.terasology.engine.network.internal.ClientConnectionHandler)1 ClientHandler (org.terasology.engine.network.internal.ClientHandler)1 ClientHandshakeHandler (org.terasology.engine.network.internal.ClientHandshakeHandler)1 JoinStatusImpl (org.terasology.engine.network.internal.JoinStatusImpl)1 MetricRecordingHandler (org.terasology.engine.network.internal.MetricRecordingHandler)1