use of com.hazelcast.internal.server.tcp.SingleProtocolEncoder in project hazelcast by hazelcast.
the class TextChannelInitializer method initChannel.
@Override
public void initChannel(Channel channel) {
ServerConnection connection = (TcpServerConnection) channel.attributeMap().get(ServerConnection.class);
SingleProtocolEncoder encoder = new SingleProtocolEncoder(new TextEncoder(connection));
InboundHandler decoder = rest ? new RestApiTextDecoder(connection, (TextEncoder) encoder.getFirstOutboundHandler(), true) : new MemcacheTextDecoder(connection, (TextEncoder) encoder.getFirstOutboundHandler(), true);
TextHandshakeDecoder handshaker = new TextHandshakeDecoder(rest ? ProtocolType.REST : ProtocolType.MEMCACHE, decoder, encoder);
channel.outboundPipeline().addLast(encoder);
channel.inboundPipeline().addLast(handshaker);
}
Aggregations