Package org.apache.mina.transport.socket.nio

Examples of org.apache.mina.transport.socket.nio.SocketAcceptor.bind()


                "codec",
                new ProtocolCodecFilter(new TextLineCodecFactory(Charset
                        .forName("UTF-8"))));

        // Bind
        acceptor.bind(new InetSocketAddress(PORT),
                new ReverseProtocolHandler(), cfg);

        System.out.println("Listening on port " + PORT);
    }
}
View Full Code Here


        }

        addLogger(chain);

        // Bind
        acceptor.bind(new InetSocketAddress(PORT), new EchoProtocolHandler(),
                config);

        System.out.println("Listening on port " + PORT);
    }
View Full Code Here

                    new ProtocolCodecFilter(
                            new ObjectSerializationCodecFactory()));
        }
        cfg.getFilterChain().addLast("logger", new LoggingFilter());

        acceptor.bind(new InetSocketAddress(SERVER_PORT),
                new ServerSessionHandler(), cfg);

        System.out.println("Listening on port " + SERVER_PORT);
    }
}
View Full Code Here

                new TextLineCodecFactory()));

        addLogger(chain);

        // Bind
        acceptor.bind(new InetSocketAddress(PORT), new ChatProtocolHandler(),
                config);

        System.out.println("Listening on port " + PORT);
    }
View Full Code Here

        ByteBuffer.setUseDirectBuffers(false);
        ByteBuffer.setAllocator(new SimpleByteBufferAllocator());
       
        IoAcceptor acceptor = new SocketAcceptor();
        IoAcceptorConfig config = new SocketAcceptorConfig();
        acceptor.bind( new InetSocketAddress(PORT), new ProfilerServerHandler(), config);
        log.info("PBLabs Profiler server started on localhost:" + PORT);
  }
}
View Full Code Here

      throws IOException {
    final IoAcceptor acceptor = new SocketAcceptor();
    IoAcceptorConfig config = new SocketAcceptorConfig();
    config.setDisconnectOnUnbind(true);
    ((SocketSessionConfig) config.getSessionConfig()).setReuseAddress(true);
    acceptor.bind(new InetSocketAddress(ip, port), handler, config);
    Runtime.getRuntime().addShutdownHook(new Thread() {
      @Override
      public void run() {
        acceptor.unbindAll();
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.