use of net.ripe.rpki.rtr.adapter.netty.PduCodec in project rpki-validator-3 by RIPE-NCC.
the class RtrServer method runNetty.
private void runNetty() throws InterruptedException {
bossGroup = new NioEventLoopGroup();
workerGroup = new NioEventLoopGroup();
try {
ServerBootstrap b = new ServerBootstrap();
b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).childHandler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel ch) {
ChannelTrafficShapingHandler traffic = new ChannelTrafficShapingHandler(0);
RtrClientHandler rtrClientHandler = rtrClientHandlerProvider.get();
rtrClientHandler.setTrafficShapingHandler(traffic);
ch.pipeline().addLast(traffic, new PduCodec(), new ChunkedWriteHandler(), rtrClientHandler);
}
}).option(ChannelOption.SO_BACKLOG, 128).childOption(ChannelOption.SO_KEEPALIVE, true);
log.info("Running RTR at port {}", port);
ChannelFuture f = b.bind(port).sync();
f.channel().closeFuture().sync();
} finally {
shutdownWorkers();
}
}
Aggregations