private final ChannelFactory factory = new DefaultLocalServerChannelFactory();
private volatile Channel serverChannel;
public void start() {
ServerBootstrap serverBootstrap = new ServerBootstrap(factory);
EchoServerHandler handler = new EchoServerHandler();
serverBootstrap.getPipeline().addLast("handler", handler);
// Note that "myLocalServer" is the endpoint which was specified in web.xml.
serverChannel = serverBootstrap.bind(new LocalAddress("myLocalServer"));
}