Search in sources :

Example 11 with LengthFieldBasedFrameDecoder

use of org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder in project traccar by traccar.

the class CastelProtocol method initTrackerServers.

@Override
public void initTrackerServers(List<TrackerServer> serverList) {
    TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {

        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 2, 2, -4, 0));
            pipeline.addLast("objectEncoder", new CastelProtocolEncoder());
            pipeline.addLast("objectDecoder", new CastelProtocolDecoder(CastelProtocol.this));
        }
    };
    server.setEndianness(ByteOrder.LITTLE_ENDIAN);
    serverList.add(server);
    server = new TrackerServer(new ConnectionlessBootstrap(), getName()) {

        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("objectEncoder", new CastelProtocolEncoder());
            pipeline.addLast("objectDecoder", new CastelProtocolDecoder(CastelProtocol.this));
        }
    };
    server.setEndianness(ByteOrder.LITTLE_ENDIAN);
    serverList.add(server);
}
Also used : TrackerServer(org.traccar.TrackerServer) LengthFieldBasedFrameDecoder(org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder) ServerBootstrap(org.jboss.netty.bootstrap.ServerBootstrap) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline) ConnectionlessBootstrap(org.jboss.netty.bootstrap.ConnectionlessBootstrap)

Example 12 with LengthFieldBasedFrameDecoder

use of org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder in project graphdb by neo4j-attic.

the class Protocol method addLengthFieldPipes.

public static void addLengthFieldPipes(ChannelPipeline pipeline) {
    pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(MAX_FRAME_LENGTH + 4, 0, 4, 0, 4));
    pipeline.addLast("frameEncoder", new LengthFieldPrepender(4));
}
Also used : LengthFieldPrepender(org.jboss.netty.handler.codec.frame.LengthFieldPrepender) LengthFieldBasedFrameDecoder(org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder)

Example 13 with LengthFieldBasedFrameDecoder

use of org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder in project neo4j by neo4j.

the class Protocol method addLengthFieldPipes.

public static void addLengthFieldPipes(ChannelPipeline pipeline, int frameLength) {
    pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(frameLength + 4, 0, 4, 0, 4));
    pipeline.addLast("frameEncoder", new LengthFieldPrepender(4));
}
Also used : LengthFieldPrepender(org.jboss.netty.handler.codec.frame.LengthFieldPrepender) LengthFieldBasedFrameDecoder(org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder)

Example 14 with LengthFieldBasedFrameDecoder

use of org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder 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 15 with LengthFieldBasedFrameDecoder

use of org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder in project traccar by tananaev.

the class NavisProtocol method initTrackerServers.

@Override
public void initTrackerServers(List<TrackerServer> serverList) {
    TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {

        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(4 * 1024, 12, 2, 2, 0));
            pipeline.addLast("objectDecoder", new NavisProtocolDecoder(NavisProtocol.this));
        }
    };
    server.setEndianness(ByteOrder.LITTLE_ENDIAN);
    serverList.add(server);
}
Also used : TrackerServer(org.traccar.TrackerServer) LengthFieldBasedFrameDecoder(org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder) ServerBootstrap(org.jboss.netty.bootstrap.ServerBootstrap) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

Aggregations

LengthFieldBasedFrameDecoder (org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder)26 ChannelPipeline (org.jboss.netty.channel.ChannelPipeline)24 ServerBootstrap (org.jboss.netty.bootstrap.ServerBootstrap)22 TrackerServer (org.traccar.TrackerServer)22 ConnectionlessBootstrap (org.jboss.netty.bootstrap.ConnectionlessBootstrap)8 ZlibDecoder (org.jboss.netty.handler.codec.compression.ZlibDecoder)2 LengthFieldPrepender (org.jboss.netty.handler.codec.frame.LengthFieldPrepender)2 ProtobufDecoder (org.jboss.netty.handler.codec.protobuf.ProtobufDecoder)2 ProtobufEncoder (org.jboss.netty.handler.codec.protobuf.ProtobufEncoder)2 ProtobufVarint32FrameDecoder (org.jboss.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder)2 ProtobufVarint32LengthFieldPrepender (org.jboss.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender)2 StringEncoder (org.jboss.netty.handler.codec.string.StringEncoder)2 ClientHandshakeHandler (org.terasology.network.internal.ClientHandshakeHandler)2 JoinStatusImpl (org.terasology.network.internal.JoinStatusImpl)2 MetricRecordingHandler (org.terasology.network.internal.MetricRecordingHandler)2 ClientConnectionHandler (org.terasology.network.internal.ClientConnectionHandler)1 ClientHandler (org.terasology.network.internal.ClientHandler)1 ServerInfoRequestHandler (org.terasology.network.internal.ServerInfoRequestHandler)1