Exemplo n.º 1
0
  public void start() throws Exception {
    acceptor = new SocketAcceptor();

    // Prepare the configuration
    SocketAcceptorConfig cfg = new SocketAcceptorConfig();
    cfg.setReuseAddress(true);
    Charset charset = Charset.forName("UTF-8");
    cfg.getFilterChain()
        .addLast("codec", new ProtocolCodecFilter(new TextLineCodecFactory(charset)));

    // Bind
    acceptor.bind(new InetSocketAddress(port), new ReverseProtocolHandler(), cfg);
  }
Exemplo n.º 2
0
 public void stop() throws Exception {
   acceptor.unbindAll();
 }