Search in sources :

Example 1 with ProtobufEncoder

use of org.jboss.netty.handler.codec.protobuf.ProtobufEncoder in project Terasology by MovingBlocks.

the class InfoRequestPipelineFactory method getPipeline.

@Override
public ChannelPipeline getPipeline() throws Exception {
    JoinStatusImpl joinStatus = new JoinStatusImpl();
    ChannelPipeline p = Channels.pipeline();
    p.addLast(MetricRecordingHandler.NAME, new MetricRecordingHandler());
    p.addLast("lengthFrameDecoder", new LengthFieldBasedFrameDecoder(8388608, 0, 3, 0, 3));
    p.addLast("inflateDecoder", new ZlibDecoder());
    p.addLast("frameDecoder", new ProtobufVarint32FrameDecoder());
    p.addLast("protobufDecoder", new ProtobufDecoder(NetData.NetMessage.getDefaultInstance()));
    p.addLast("frameEncoder", new ProtobufVarint32LengthFieldPrepender());
    p.addLast("protobufEncoder", new ProtobufEncoder());
    p.addLast("authenticationHandler", new ClientHandshakeHandler(joinStatus));
    p.addLast("connectionHandler", new ServerInfoRequestHandler());
    return p;
}
Also used : ProtobufEncoder(org.jboss.netty.handler.codec.protobuf.ProtobufEncoder) ClientHandshakeHandler(org.terasology.network.internal.ClientHandshakeHandler) ZlibDecoder(org.jboss.netty.handler.codec.compression.ZlibDecoder) MetricRecordingHandler(org.terasology.network.internal.MetricRecordingHandler) ProtobufDecoder(org.jboss.netty.handler.codec.protobuf.ProtobufDecoder) ProtobufVarint32LengthFieldPrepender(org.jboss.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender) LengthFieldBasedFrameDecoder(org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder) ProtobufVarint32FrameDecoder(org.jboss.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder) JoinStatusImpl(org.terasology.network.internal.JoinStatusImpl) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline) ServerInfoRequestHandler(org.terasology.network.internal.ServerInfoRequestHandler)

Example 2 with ProtobufEncoder

use of org.jboss.netty.handler.codec.protobuf.ProtobufEncoder in project Terasology by MovingBlocks.

the class TerasologyClientPipelineFactory method getPipeline.

@Override
public ChannelPipeline getPipeline() throws Exception {
    JoinStatusImpl joinStatus = new JoinStatusImpl();
    ChannelPipeline p = pipeline();
    p.addLast(MetricRecordingHandler.NAME, new MetricRecordingHandler());
    p.addLast("lengthFrameDecoder", new LengthFieldBasedFrameDecoder(8388608, 0, 3, 0, 3));
    p.addLast("inflateDecoder", new ZlibDecoder());
    p.addLast("frameDecoder", new ProtobufVarint32FrameDecoder());
    p.addLast("protobufDecoder", new ProtobufDecoder(NetData.NetMessage.getDefaultInstance()));
    p.addLast("frameEncoder", new ProtobufVarint32LengthFieldPrepender());
    p.addLast("protobufEncoder", new ProtobufEncoder());
    p.addLast("authenticationHandler", new ClientHandshakeHandler(joinStatus));
    p.addLast("connectionHandler", new ClientConnectionHandler(joinStatus, networkSystem));
    p.addLast("handler", new ClientHandler(networkSystem));
    return p;
}
Also used : ProtobufEncoder(org.jboss.netty.handler.codec.protobuf.ProtobufEncoder) ClientHandshakeHandler(org.terasology.network.internal.ClientHandshakeHandler) ZlibDecoder(org.jboss.netty.handler.codec.compression.ZlibDecoder) MetricRecordingHandler(org.terasology.network.internal.MetricRecordingHandler) ProtobufDecoder(org.jboss.netty.handler.codec.protobuf.ProtobufDecoder) ProtobufVarint32LengthFieldPrepender(org.jboss.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender) ClientHandler(org.terasology.network.internal.ClientHandler) ClientConnectionHandler(org.terasology.network.internal.ClientConnectionHandler) LengthFieldBasedFrameDecoder(org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder) ProtobufVarint32FrameDecoder(org.jboss.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder) JoinStatusImpl(org.terasology.network.internal.JoinStatusImpl) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

Example 3 with ProtobufEncoder

use of org.jboss.netty.handler.codec.protobuf.ProtobufEncoder in project Terasology by MovingBlocks.

the class TerasologyServerPipelineFactory method getPipeline.

@Override
public ChannelPipeline getPipeline() throws Exception {
    ChannelPipeline p = pipeline();
    p.addLast(MetricRecordingHandler.NAME, new MetricRecordingHandler());
    p.addLast("frameDecoder", new ProtobufVarint32FrameDecoder());
    p.addLast("protobufDecoder", new ProtobufDecoder(NetData.NetMessage.getDefaultInstance()));
    p.addLast("frameLengthEncoder", new LengthFieldPrepender(3));
    p.addLast("deflateEncoder", new ZlibEncoder());
    p.addLast("frameEncoder", new ProtobufVarint32LengthFieldPrepender());
    p.addLast("protobufEncoder", new ProtobufEncoder());
    p.addLast("authenticationHandler", new ServerHandshakeHandler());
    p.addLast("connectionHandler", new ServerConnectionHandler(networkSystem));
    p.addLast("handler", new ServerHandler(networkSystem));
    return p;
}
Also used : ZlibEncoder(org.jboss.netty.handler.codec.compression.ZlibEncoder) ProtobufEncoder(org.jboss.netty.handler.codec.protobuf.ProtobufEncoder) ServerConnectionHandler(org.terasology.network.internal.ServerConnectionHandler) ServerHandshakeHandler(org.terasology.network.internal.ServerHandshakeHandler) MetricRecordingHandler(org.terasology.network.internal.MetricRecordingHandler) ProtobufDecoder(org.jboss.netty.handler.codec.protobuf.ProtobufDecoder) ProtobufVarint32LengthFieldPrepender(org.jboss.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender) ServerHandler(org.terasology.network.internal.ServerHandler) ProtobufVarint32LengthFieldPrepender(org.jboss.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender) LengthFieldPrepender(org.jboss.netty.handler.codec.frame.LengthFieldPrepender) ProtobufVarint32FrameDecoder(org.jboss.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

Aggregations

ChannelPipeline (org.jboss.netty.channel.ChannelPipeline)3 ProtobufDecoder (org.jboss.netty.handler.codec.protobuf.ProtobufDecoder)3 ProtobufEncoder (org.jboss.netty.handler.codec.protobuf.ProtobufEncoder)3 ProtobufVarint32FrameDecoder (org.jboss.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder)3 ProtobufVarint32LengthFieldPrepender (org.jboss.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender)3 MetricRecordingHandler (org.terasology.network.internal.MetricRecordingHandler)3 ZlibDecoder (org.jboss.netty.handler.codec.compression.ZlibDecoder)2 LengthFieldBasedFrameDecoder (org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder)2 ClientHandshakeHandler (org.terasology.network.internal.ClientHandshakeHandler)2 JoinStatusImpl (org.terasology.network.internal.JoinStatusImpl)2 ZlibEncoder (org.jboss.netty.handler.codec.compression.ZlibEncoder)1 LengthFieldPrepender (org.jboss.netty.handler.codec.frame.LengthFieldPrepender)1 ClientConnectionHandler (org.terasology.network.internal.ClientConnectionHandler)1 ClientHandler (org.terasology.network.internal.ClientHandler)1 ServerConnectionHandler (org.terasology.network.internal.ServerConnectionHandler)1 ServerHandler (org.terasology.network.internal.ServerHandler)1 ServerHandshakeHandler (org.terasology.network.internal.ServerHandshakeHandler)1 ServerInfoRequestHandler (org.terasology.network.internal.ServerInfoRequestHandler)1