public void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast("framer", new DelimiterBasedFrameDecoder(8192, Delimiters.lineDelimiter()));
pipeline.addLast("decoder", new StringDecoder());
pipeline.addLast("syslogDecoder", new MessageToMessageDecoder<String>() {
Function<Buffer, SyslogMessage> decoder = new SyslogCodec().decoder(null);
@Override
public void decode(ChannelHandlerContext ctx, String msg, List<Object> messages) throws Exception {
messages.add(decoder.apply(Buffer.wrap(msg + "\n")));
}