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

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


    public static void main( String[] args ) throws Throwable
    {
        // Create ServiceRegistry.
        IoAcceptor acceptor = new SocketAcceptor();

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

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


                new ServerToProxyIoHandler(), connector,
                new InetSocketAddress( args[ 1 ],
                        Integer.parseInt( args[ 2 ] ) ) );
       
        // Start proxy.
        acceptor.bind( new InetSocketAddress( Integer.parseInt( args[ 0 ] ) ), handler );

        System.out.println( "Listening on port " + Integer.parseInt( args[ 0 ] ) );
    }
   
}
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

        {
            addSSLSupport( chain );
        }

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

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

    public static void main( String[] args ) throws Exception
    {
        IoAcceptor acceptor = new SocketAcceptor();

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

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

                4 * 1024 * 1024);

        SenderHandler sender = new SenderHandler(stream);
        ReceiverHandler receiver = new ReceiverHandler(stream.size);

        acceptor.bind(address, sender);

        synchronized (sender.lock) {
            synchronized (receiver.lock) {
                connector.connect(address, receiver);

View Full Code Here

                "to-string",
                new ProtocolCodecFilter(new TextLineCodecFactory(Charset
                        .forName("US-ASCII"))));
        config.getFilterChain().addLast("to-haiki", new ToHaikuIoFilter());

        acceptor.bind(new InetSocketAddress(42458),
                new HaikuValidatorIoHandler(), config);
    }
}
View Full Code Here

        ClientToProxyIoHandler handler = new ClientToProxyIoHandler(
                new ServerToProxyIoHandler(), connector, new InetSocketAddress(
                        args[1], Integer.parseInt(args[2])));

        // Start proxy.
        acceptor
                .bind(new InetSocketAddress(Integer.parseInt(args[0])), handler);

        System.out.println("Listening on port " + Integer.parseInt(args[0]));
    }
View Full Code Here

                    "protocolFilter",
                    new ProtocolCodecFilter(
                            new HttpServerProtocolCodecFactory()));
            cfg.getFilterChain().addLast("logger", new LoggingFilter());

            acceptor
                    .bind(new InetSocketAddress(port), new ServerHandler(), cfg);

            System.out.println("Server now listening on port " + port);
        } catch (Exception ex) {
            ex.printStackTrace();
View Full Code Here

        if (USE_SSL) {
            addSSLSupport(chain);
        }

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

        System.out.println("Listening on port " + PORT);
    }
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.