Package org.apache.mina.common

Examples of org.apache.mina.common.IoAcceptor.bind()


    {
        IoAcceptor acceptor = new VmPipeAcceptor();
        VmPipeAddress address = new VmPipeAddress( 8080 );

        // Set up server
        acceptor.bind( address, new TennisPlayer() );

        // Connect to the server.
        VmPipeConnector connector = new VmPipeConnector();
        ConnectFuture future = connector.connect( address,
                                                  new TennisPlayer() );
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

        {
            addSSLSupport( chain );
        }

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

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

        final AtomicReference<IoSession> c1 = new AtomicReference<IoSession>();
        final CountDownLatch latch = new CountDownLatch( 1 );
        final CountDownLatch messageCount = new CountDownLatch( 2 );
        IoAcceptor acceptor = new VmPipeAcceptor();

        acceptor.bind( address, new IoHandlerAdapter() {
            @Override
            public void messageReceived( IoSession session, Object message ) throws Exception {
                System.out.println( Thread.currentThread().getName() + ": " + message );

                if ( "start".equals( message ) ) {
View Full Code Here

                4 * 1024 * 1024);

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

        acceptor.bind(address, sender);

        connector.connect(address, receiver);
        sender.latch.await();
        receiver.latch.await();

View Full Code Here

                }
                else
                {
                    bindAddress = new InetSocketAddress(InetAddress.getByAddress(parseIP(bindAddr)), port);
                }
                acceptor.bind(bindAddress, handler, sconfig);
                _logger.info("Qpid.AMQP listening on non-SSL address " + bindAddress);
            }

            if (connectorConfig.enableSSL)
            {
View Full Code Here

            {
                AMQPFastProtocolHandler handler = new AMQPProtocolProvider().getHandler();
                handler.setUseSSL(true);
                try
                {
                    acceptor.bind(new InetSocketAddress(connectorConfig.sslPort),
                                  handler, sconfig);
                    _logger.info("Qpid.AMQP listening on SSL port " + connectorConfig.sslPort);
                }
                catch (IOException e)
                {
View Full Code Here

            String host = InetAddress.getLocalHost().getHostName();
            ClusteredProtocolHandler handler = new ClusteredProtocolHandler(new InetSocketAddress(host, port));
            if (connectorConfig.enableNonSSL)
            {
                acceptor.bind(new InetSocketAddress(port), handler, sconfig);
                _logger.info("Qpid.AMQP listening on non-SSL port " + port);
                handler.connect(commandLine.getOptionValue("j"));
            }

            if (connectorConfig.enableSSL)
View Full Code Here

            if (connectorConfig.enableSSL)
            {
                ClusteredProtocolHandler sslHandler = new ClusteredProtocolHandler(handler);
                sslHandler.setUseSSL(true);
                acceptor.bind(new InetSocketAddress(connectorConfig.sslPort), handler, sconfig);
                _logger.info("Qpid.AMQP listening on SSL port " + connectorConfig.sslPort);
            }
        }
        catch (IOException e)
        {
View Full Code Here

        IoServiceConfig config2 =
            ( IoServiceConfig ) MockControl.createControl( IoServiceConfig.class ).getMock();
        MockControl mockIoAcceptor = MockControl.createControl( IoAcceptor.class );
        IoAcceptor acceptor = ( IoAcceptor ) mockIoAcceptor.getMock();
       
        acceptor.bind( new InetSocketAddress( 80 ), handler1, config1 );
        acceptor.bind( new InetSocketAddress( "192.168.0.1", 22 ), handler2, config2 );
        acceptor.bind( new InetSocketAddress( "10.0.0.1", 9876 ), handler3 );
        acceptor.unbind( new InetSocketAddress( 80 ) );
        acceptor.unbind( new InetSocketAddress( "192.168.0.1", 22 ) );
        acceptor.unbind( new InetSocketAddress( "10.0.0.1", 9876 ) );
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.