use of org.jboss.netty.handler.codec.frame.LengthFieldPrepender in project camel by apache.
the class MultipleCodecsTest method createRegistry.
@Override
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry registry = super.createRegistry();
// START SNIPPET: registry-beans
ChannelHandlerFactory lengthDecoder = ChannelHandlerFactories.newLengthFieldBasedFrameDecoder(1048576, 0, 4, 0, 4);
StringDecoder stringDecoder = new StringDecoder();
registry.bind("length-decoder", lengthDecoder);
registry.bind("string-decoder", stringDecoder);
LengthFieldPrepender lengthEncoder = new LengthFieldPrepender(4);
StringEncoder stringEncoder = new StringEncoder();
registry.bind("length-encoder", lengthEncoder);
registry.bind("string-encoder", stringEncoder);
List<ChannelHandler> decoders = new ArrayList<ChannelHandler>();
decoders.add(lengthDecoder);
decoders.add(stringDecoder);
List<ChannelHandler> encoders = new ArrayList<ChannelHandler>();
encoders.add(lengthEncoder);
encoders.add(stringEncoder);
registry.bind("encoders", encoders);
registry.bind("decoders", decoders);
// END SNIPPET: registry-beans
return registry;
}
use of org.jboss.netty.handler.codec.frame.LengthFieldPrepender 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));
}
use of org.jboss.netty.handler.codec.frame.LengthFieldPrepender 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));
}
use of org.jboss.netty.handler.codec.frame.LengthFieldPrepender 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;
}
Aggregations