Search in sources :

Example 1 with SingleProtocolEncoder

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);
}
Also used : SingleProtocolEncoder(com.hazelcast.internal.server.tcp.SingleProtocolEncoder) InboundHandler(com.hazelcast.internal.networking.InboundHandler) TcpServerConnection(com.hazelcast.internal.server.tcp.TcpServerConnection) ServerConnection(com.hazelcast.internal.server.ServerConnection) TcpServerConnection(com.hazelcast.internal.server.tcp.TcpServerConnection) TextHandshakeDecoder(com.hazelcast.internal.server.tcp.TextHandshakeDecoder)

Aggregations

InboundHandler (com.hazelcast.internal.networking.InboundHandler)1 ServerConnection (com.hazelcast.internal.server.ServerConnection)1 SingleProtocolEncoder (com.hazelcast.internal.server.tcp.SingleProtocolEncoder)1 TcpServerConnection (com.hazelcast.internal.server.tcp.TcpServerConnection)1 TextHandshakeDecoder (com.hazelcast.internal.server.tcp.TextHandshakeDecoder)1