Package org.apache.mina.common

Examples of org.apache.mina.common.ConnectFuture.join()


        acceptor.bind(new InetSocketAddress(port), acceptorHandler, config);

        try {
            ConnectFuture future = connector.connect(new InetSocketAddress(
                    "localhost", port), connectorHandler, config);
            future.join();

            // Write whatever to trigger the acceptor.
            future.getSession().write(ByteBuffer.allocate(1)).join();

            // Wait until the connection is closed.
View Full Code Here


        acceptor.bind(new InetSocketAddress(port), acceptorHandler, config);

        try {
            ConnectFuture future = connector.connect(new InetSocketAddress(
                    "localhost", port), connectorHandler, config);
            future.join();

            // Write whatever to trigger the acceptor.
            future.getSession().write(ByteBuffer.allocate(1)).join();

            // Make sure the connection is closed before recycler closes it.
View Full Code Here

       
        final VmPipeAddress address = new VmPipeAddress(_port);
        _logger.info("Attempting connection to " + address);
        ConnectFuture future = ioConnector.connect(address, protocolHandler);
        // wait for connection to complete
        future.join();
        // we call getSession which throws an IOException if there has been an error connecting
        future.getSession();
    }
}
View Full Code Here

        protocolHandler.setUseSSL(brokerDetail.useSSL());
        _logger.info("Attempting connection to " + address);
        ConnectFuture future = ioConnector.connect(address, protocolHandler);

        // wait for connection to complete
        if (future.join(brokerDetail.getTimeout()))
        {
            // we call getSession which throws an IOException if there has been an error connecting
            future.getSession();
        }
        else
View Full Code Here

    //extablish connection without handling redirect
    boolean connect() throws IOException, InterruptedException
    {
        ConnectFuture future = connectImpl();
        // wait for connection to complete
        future.join();
        // we call getSession which throws an IOException if there has been an error connecting
        try
        {
            future.getSession();
        }
View Full Code Here

            LOG.debug("Creating connector to address: {} using connector: {} timeout: {} millis.", new Object[]{address, connector, timeout});
        }
        IoHandler ioHandler = new ResponseHandler(getEndpoint());
        // connect and wait until the connection is established
        ConnectFuture future = connector.connect(address, ioHandler, getEndpoint().getConnectorConfig());
        future.join();
        session = future.getSession();
    }

    /**
     * Handles response from session writes
View Full Code Here

            LOG.debug("Creating connector to address: {} using connector: {} timeout: {} millis.", new Object[]{address, connector, timeout});
        }
        IoHandler ioHandler = new ResponseHandler(getEndpoint());
        // connect and wait until the connection is established
        ConnectFuture future = connector.connect(address, ioHandler, getEndpoint().getConnectorConfig());
        future.join();
        session = future.getSession();
    }

    /**
     * Handles response from session writes
View Full Code Here

            {
                ConnectFuture future = connector.connect(
                        new InetSocketAddress( HOSTNAME, PORT ),
                        new ClientSessionHandler( USE_CUSTOM_CODEC, values ) );
               
                future.join();
                session = future.getSession();
                break;
            }
            catch( IOException e )
            {
View Full Code Here

        // Connect to the server.
        VmPipeConnector connector = new VmPipeConnector();
        ConnectFuture future = connector.connect( address,
                                                  new TennisPlayer() );
        future.join();
        IoSession session = future.getSession();

        // Send the first ping message
        session.write( new TennisBall( 10 ) );
View Full Code Here

        if( !useLocalAddress )
        {
            ConnectFuture future = connector.connect(
                    new InetSocketAddress( "localhost", port ),
                    handler );
            future.join();
            session = future.getSession();
        }
        else
        {
            int clientPort = 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.