public void start(int port) throws IOException {
factory = new NioDatagramChannelFactory();
ConnectionlessBootstrap bootstrap = new ConnectionlessBootstrap(factory);
bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
public ChannelPipeline getPipeline() throws Exception {
return Channels.pipeline(new SimpleChannelUpstreamHandler() {
@Override
public void childChannelOpen(ChannelHandlerContext ctx, ChildChannelStateEvent e) throws Exception {
System.out.println("childChannelOpen");
setAttribute(ctx, STATE_ATTRIBUTE, State.WAIT_FOR_FIRST_BYTE_LENGTH);
}