Package org.apache.mina.common

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


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


    protected abstract SocketAddress createServerSocketAddress( int port );
   
    public void testSuspendResumeReadWrite() throws Exception
    {
        ConnectFuture future = connect( port, new ClientIoHandler() );
        future.join();
        IoSession session = future.getSession();
       
        Object lock = session.getAttribute( "lock" );
        synchronized( lock )
        {
View Full Code Here

        acceptor.bind(address, new TennisPlayer());

        // 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

                sslFilter.setUseClientMode(true);
                config.getFilterChain().addLast("sslFilter", sslFilter);
            }

            ConnectFuture future1 = connector.connect(address, handler, config);
            future1.join();
            if (!future1.isConnected()) {
                return false;
            }
            session = future1.getSession();
            session.write("LOGIN " + name);
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();

            // 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

        acceptor.bind(new InetSocketAddress(port), mockHandler, expectedConfig);

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

            WriteFuture writeFuture = future.getSession().write(
                    ByteBuffer.allocate(16).putInt(0).flip());
            writeFuture.join();
            Assert.assertTrue(writeFuture.isWritten());
View Full Code Here

        IoConnector connector = new SocketConnector();
        IoSession[] sessions = new IoSession[5];
        for (int i = 0; i < sessions.length; i++) {
            ConnectFuture future = connector.connect(new InetSocketAddress(
                    "localhost", port), new IoHandlerAdapter());
            future.join();
            sessions[i] = future.getSession();
            Assert.assertTrue(sessions[i].isConnected());
        }

        // Wait for the server side sessions to be created.
View Full Code Here

    protected abstract SocketAddress createServerSocketAddress(int port);

    public void testSuspendResumeReadWrite() throws Exception {
        ConnectFuture future = connect(port, new ClientIoHandler());
        future.join();
        IoSession session = future.getSession();

        // We wait for the sessionCreated() event is fired because we cannot guarantee that
        // it is invoked already.
        while (session.getAttribute("lock") == null) {
View Full Code Here

                        actual.append("A");
                    }

                });

        future.join();
        future.getSession().getCloseFuture().join();
        acceptor.unbindAll();

        // sessionClosed() might not be invoked yet
        // even if the connection is closed.
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.