use of io.netty.handler.codec.xml.XmlFrameDecoder in project opennms by OpenNMS.
the class TcpListener method start.
public void start() throws InterruptedException {
bossGroup = new NioEventLoopGroup();
workerGroup = new NioEventLoopGroup();
final ServerBootstrap b = new ServerBootstrap();
b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).option(ChannelOption.SO_BACKLOG, 128).childOption(ChannelOption.SO_KEEPALIVE, true).childHandler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel ch) throws Exception {
ch.pipeline().addLast(new LoggingHandler());
ch.pipeline().addLast(new XmlFrameDecoder(2147483647));
ch.pipeline().addLast(new XmlEventProcessor(eventIpcManager));
}
});
// Bind and start to accept incoming connections.
future = b.bind(config.getTCPIpAddress(), config.getTCPPort()).sync().await();
}
use of io.netty.handler.codec.xml.XmlFrameDecoder in project opennms by OpenNMS.
the class UdpListener method start.
public void start() throws InterruptedException {
bossGroup = new NioEventLoopGroup();
final Bootstrap b = new Bootstrap().group(bossGroup).channel(NioDatagramChannel.class).option(ChannelOption.SO_REUSEADDR, true).option(ChannelOption.SO_RCVBUF, Integer.MAX_VALUE).handler(new ChannelInitializer<DatagramChannel>() {
@Override
protected void initChannel(DatagramChannel ch) throws Exception {
ch.pipeline().addLast(new LoggingHandler());
ch.pipeline().addLast(new MessageToMessageDecoder<DatagramPacket>() {
@Override
protected void decode(ChannelHandlerContext ctx, DatagramPacket msg, List<Object> out) throws Exception {
msg.retain();
out.add(msg.content());
}
});
ch.pipeline().addLast(new XmlFrameDecoder(2147483647));
ch.pipeline().addLast(new XmlEventProcessor(eventIpcManager));
}
});
future = b.bind(config.getUDPIpAddress(), config.getUDPPort()).await();
}
Aggregations