@Override public void applyProtocol(PlayerSession playerSession) { ChannelPipeline pipeline = NettyUtils .getPipeLineOfConnection(playerSession); // Upstream handlers or encoders (i.e towards server) are added to // pipeline now. pipeline.addLast("framer", new DelimiterBasedFrameDecoder(frameSize, Delimiters.nulDelimiter())); pipeline.addLast("stringDecoder", stringDecoder); // Downstream handlers (i.e towards client) are added to pipeline now. pipeline.addLast("nulEncoder", nulEncoder); pipeline.addLast("stringEncoder", stringEncoder); }
@Override public void applyProtocol(PlayerSession playerSession) { ChannelPipeline pipeline = NettyUtils .getPipeLineOfConnection(playerSession); // Upstream handlers or encoders (i.e towards server) are added to // pipeline now. pipeline.addLast("framer", new DelimiterBasedFrameDecoder(maxFrameSize, Delimiters.nulDelimiter())); pipeline.addLast("base64Decoder", base64Decoder); pipeline.addLast("amf3ToJavaObjectDecoder", amf3ToJavaObjectDecoder); // Downstream handlers - Filter for data which flows from server to // client. Note that the last handler added is actually the first // handler for outgoing data. pipeline.addLast("nulEncoder", nulEncoder); pipeline.addLast("base64Encoder", base64Encoder); pipeline.addLast("javaObjectToAMF3Encoder", javaObjectToAMF3Encoder); }
protected TcpTransport(final Configuration configuration, final Executor bossPool, final Executor workerPool, final ThroughputCounter throughputCounter, final ConnectionCounter connectionCounter, final LocalMetricRegistry localRegistry) { super(configuration, throughputCounter, localRegistry, bossPool, workerPool, connectionCounter); final boolean nulDelimiter = configuration.getBoolean(CK_USE_NULL_DELIMITER); this.delimiter = nulDelimiter ? nulDelimiter() : lineDelimiter(); this.maxFrameLength = configuration.getInt(CK_MAX_MESSAGE_SIZE, Config.DEFAULT_MAX_FRAME_LENGTH); }
protected TcpTransport(final Configuration configuration, final Executor bossPool, final Executor workerPool, final ThroughputCounter throughputCounter, final ConnectionCounter connectionCounter, final LocalMetricRegistry localRegistry) { super(configuration, throughputCounter, localRegistry, bossPool, workerPool, connectionCounter); final boolean nulDelimiter = configuration.getBoolean(CK_USE_NULL_DELIMITER); this.delimiter = nulDelimiter ? nulDelimiter() : lineDelimiter(); this.tcpKeepalive = configuration.getBoolean(CK_TCP_KEEPALIVE); this.maxFrameLength = configuration.getInt(CK_MAX_MESSAGE_SIZE, Config.DEFAULT_MAX_FRAME_LENGTH); }
Charset charset = getEncoding() != null ? Charset.forName(getEncoding()) : CharsetUtil.UTF_8; encoders.add(ChannelHandlerFactories.newStringEncoder(charset)); ChannelBuffer[] delimiters = delimiter == TextLineDelimiter.LINE ? Delimiters.lineDelimiter() : Delimiters.nulDelimiter(); decoders.add(ChannelHandlerFactories.newDelimiterBasedFrameDecoder(decoderMaxLineLength, delimiters)); decoders.add(ChannelHandlerFactories.newStringDecoder(charset));