Search in sources :

Example 6 with ProtobufVarint32FrameDecoder

use of io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder in project netty by netty.

the class WorldClockServerInitializer method initChannel.

@Override
public void initChannel(SocketChannel ch) throws Exception {
    ChannelPipeline p = ch.pipeline();
    if (sslCtx != null) {
        p.addLast(sslCtx.newHandler(ch.alloc()));
    }
    p.addLast(new ProtobufVarint32FrameDecoder());
    p.addLast(new ProtobufDecoder(WorldClockProtocol.Locations.getDefaultInstance()));
    p.addLast(new ProtobufVarint32LengthFieldPrepender());
    p.addLast(new ProtobufEncoder());
    p.addLast(new WorldClockServerHandler());
}
Also used : ProtobufEncoder(io.netty.handler.codec.protobuf.ProtobufEncoder) ProtobufDecoder(io.netty.handler.codec.protobuf.ProtobufDecoder) ProtobufVarint32LengthFieldPrepender(io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender) ProtobufVarint32FrameDecoder(io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder) ChannelPipeline(io.netty.channel.ChannelPipeline)

Aggregations

ProtobufDecoder (io.netty.handler.codec.protobuf.ProtobufDecoder)6 ProtobufVarint32FrameDecoder (io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder)6 ProtobufEncoder (io.netty.handler.codec.protobuf.ProtobufEncoder)5 ProtobufVarint32LengthFieldPrepender (io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender)5 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)3 ServerBootstrap (io.netty.bootstrap.ServerBootstrap)2 Channel (io.netty.channel.Channel)2 ChannelPipeline (io.netty.channel.ChannelPipeline)2 InetSocketAddress (java.net.InetSocketAddress)2 ExecutionException (com.intellij.execution.ExecutionException)1 Bootstrap (io.netty.bootstrap.Bootstrap)1 ChannelInitializer (io.netty.channel.ChannelInitializer)1 EventLoopGroup (io.netty.channel.EventLoopGroup)1 OioEventLoopGroup (io.netty.channel.oio.OioEventLoopGroup)1 NioServerSocketChannel (io.netty.channel.socket.nio.NioServerSocketChannel)1 NioSocketChannel (io.netty.channel.socket.nio.NioSocketChannel)1 IdleStateHandler (io.netty.handler.timeout.IdleStateHandler)1 IOException (java.io.IOException)1 InetAddress (java.net.InetAddress)1 UnknownHostException (java.net.UnknownHostException)1