@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; } }
channelPipeline.addLast("framer", new LengthFieldBasedFrameDecoder(Short.MAX_VALUE,0,2,0,2)); channelPipeline.addLast("framer-prepender", new LengthFieldPrepender(2, false));
channelPipeline.addLast("framer", new LengthFieldBasedFrameDecoder(Short.MAX_VALUE,0,2,0,2)); channelPipeline.addLast("framer-prepender", new LengthFieldPrepender(2, false));
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);
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 ) ); }
String header = "nChat v1.0"; //INBOUND pipeline.addLast(new LengthFieldBasedFrameDecoder(1024,0,2,0,2)); pipeline.addLast(new HeaderFieldDecoder(header)); pipeline.addLast(new StringDecoder()); //OUTBOUND pipeline.addLast(new LengthFieldPrepender(2)); pipeline.addLast(new HeaderFieldEncoder(header)); pipeline.addLast(new StringEncoder());
@Override public ChannelPipeline getPipeline() { ChannelPipeline pipeline = super.getPipeline(); pipeline.addLast(LENGTH_FIELD_PREPENDER, new LengthFieldPrepender(4)); pipeline.addLast(LENGTH_FIELD_BASED_FRAME_DECODER, new LengthFieldBasedFrameDecoder( Integer.MAX_VALUE, 0, 4, 0, 4)); return pipeline; } }
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline cp = Channels.pipeline(); cp.addLast("frameEncoder", new LengthFieldPrepender(4)); cp.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(maxFrameSize, 0, 4, 0, 4)); return cp; } }
public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = pipeline(); pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(maxFrameSize, 0, 4, 0, 4)); pipeline.addLast("frameEncoder", new LengthFieldPrepender(4)); pipeline.addLast("thriftHandler", (ChannelHandler)handler); return pipeline; } }
pipeline.addLast("lengthbaseddecoder", new LengthFieldBasedFrameDecoder(8 * 1024, 0, 4, 0, 4)); pipeline.addLast("lengthprepender", new LengthFieldPrepender(4)); pipeline.addLast("protobufdecoder", new ProtobufDecoder(TSOProto.Response.getDefaultInstance()));
@Override public ChannelPipeline getPipeline() { ChannelPipeline pipeline = super.getPipeline(); pipeline.addLast(LENGTH_FIELD_PREPENDER, new LengthFieldPrepender(4)); pipeline.addLast(LENGTH_FIELD_BASED_FRAME_DECODER, new LengthFieldBasedFrameDecoder( Integer.MAX_VALUE, 0, 4, 0, 4)); pipeline.addLast(HANDSHAKE_HANDLER, new TcpServerHandshakeHandler(topicParticipantManager, serviceManager)); return pipeline; } }
public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = pipeline(); pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(maxFrameSize, 0, 4, 0, 4)); pipeline.addLast("frameEncoder", new LengthFieldPrepender(4)); // pipeline.addLast("timeout", new IdleStateHandler(timer, 30, 30, 30)); pipeline.addLast("threadpool", executionHandler); // pipeline.addLast("idleHandler", new SimpleIdleHandler()); pipeline.addLast("thriftHandler", handler); return pipeline; }
pipeline.addLast("lengthprepender", new LengthFieldPrepender(4)); pipeline.addLast("protobufdecoder", new ProtobufDecoder(TSOProto.Response.getDefaultInstance())); pipeline.addLast("protobufencoder", new ProtobufEncoder());
pipeline.addLast("lengthprepender", new LengthFieldPrepender(4)); pipeline.addLast("protobufdecoder", new ProtobufDecoder(TSOProto.Response.getDefaultInstance())); pipeline.addLast("protobufencoder", new ProtobufEncoder());
public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); // Max packet length is 10MB. Transactions with so many cells // that the packet is rejected will receive a ServiceUnavailableException. // 10MB is enough for 2 million cells in a transaction though. pipeline.addLast("lengthbaseddecoder", new LengthFieldBasedFrameDecoder(10 * 1024 * 1024, 0, 4, 0, 4)); pipeline.addLast("lengthprepender", new LengthFieldPrepender(4)); pipeline.addLast("protobufdecoder", new ProtobufDecoder(TSOProto.Request.getDefaultInstance())); pipeline.addLast("protobufencoder", new ProtobufEncoder()); pipeline.addLast("handler", handler); return pipeline; } }
public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); // Max packet length is 10MB. Transactions with so many cells // that the packet is rejected will receive a ServiceUnavailableException. // 10MB is enough for 2 million cells in a transaction though. pipeline.addLast("lengthbaseddecoder", new LengthFieldBasedFrameDecoder(10 * 1024 * 1024, 0, 4, 0, 4)); pipeline.addLast("lengthprepender", new LengthFieldPrepender(4)); pipeline.addLast("protobufdecoder", new ProtobufDecoder(TSOProto.Request.getDefaultInstance())); pipeline.addLast("protobufencoder", new ProtobufEncoder()); pipeline.addLast("handler", handler); return pipeline; } }
public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); // Max packet length is 10MB. Transactions with so many cells // that the packet is rejected will receive a ServiceUnavailableException. // 10MB is enough for 2 million cells in a transaction though. pipeline.addLast("lengthbaseddecoder", new LengthFieldBasedFrameDecoder(10 * 1024 * 1024, 0, 4, 0, 4)); pipeline.addLast("lengthprepender", new LengthFieldPrepender(4)); pipeline.addLast("protobufdecoder", new ProtobufDecoder(TSOProto.Request.getDefaultInstance())); pipeline.addLast("protobufencoder", new ProtobufEncoder()); pipeline.addLast("handler", handler); return pipeline; } }
public ChannelPipeline getPipeline() throws Exception { ChannelPipeline p = Channels.pipeline(); p.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(MAX_FRAME_BYTES_LENGTH, 0, 4, 0, 4)); p.addLast("protobufDecoder", new ProtobufDecoder(defaultInstance)); p.addLast("frameEncoder", new LengthFieldPrepender(4)); p.addLast("protobufEncoder", new ProtobufEncoder()); p.addLast("handler", handlerFactory.getChannelUpstreamHandler()); return p; }
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline cp = Channels.pipeline(); TimeoutHandler.addToPipeline(cp); cp.addLast("frameEncoder", new LengthFieldPrepender(LENGTH_FIELD_LENGTH)); cp.addLast( "frameDecoder", new LengthFieldBasedFrameDecoder( maxFrameSize, LENGTH_FIELD_OFFSET, LENGTH_FIELD_LENGTH, LENGTH_ADJUSTMENT, INITIAL_BYTES_TO_STRIP)); if (clientConfig.sslClientConfiguration() != null) { cp.addFirst("ssl", clientConfig.sslClientConfiguration().createHandler(address)); } return cp; } };
public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); // Max packet length is 10MB. Transactions with so many cells // that the packet is rejected will receive a ServiceUnavailableException. // 10MB is enough for 2 million cells in a transaction though. pipeline.addLast("lengthbaseddecoder", new LengthFieldBasedFrameDecoder(10*1024*1024, 0, 4, 0, 4)); pipeline.addLast("lengthprepender", new LengthFieldPrepender(4)); pipeline.addLast("protobufdecoder", new ProtobufDecoder(TSOProto.Request.getDefaultInstance())); pipeline.addLast("protobufencoder", new ProtobufEncoder()); pipeline.addLast("handler", handler); return pipeline; }