Package org.apache.mina.core.service

Examples of org.apache.mina.core.service.IoConnector.connect()


                buf.append("Z");
            }
        });
       
        try {
            ConnectFuture future = connector.connect(new InetSocketAddress(
                    "localhost", port));
            future.awaitUninterruptibly();
            buf.append("1");
            try {
                future.getSession().close(true);
View Full Code Here


                   assertions[sessionCreatedInvokedBeforeCallback] = !assertions[callbackInvoked];
                   latch.countDown();
            }
        });
       
        ConnectFuture future = connector.connect(new InetSocketAddress("127.0.0.1", port), new IoSessionInitializer<ConnectFuture>() {
            public void initializeSession(IoSession session, ConnectFuture future) {
                assertions[callbackInvoked] = true;
                callbackFuture[0] = future;
                latch.countDown();
            }
View Full Code Here

                    }
                }
            }
           
        });
        ConnectFuture future = connector.connect(new InetSocketAddress("localhost",
                AvailablePortFinder.getNextAvailable(20000)));
        future.awaitUninterruptibly();
        IoSession session = future.getSession();

        DatagramSessionConfig cfg = ((DatagramSessionConfig) session
View Full Code Here

        InetSocketAddress addr = new InetSocketAddress("localhost",
                AvailablePortFinder.getNextAvailable(20000));

        acceptor.bind(addr);
        ConnectFuture future = connector.connect(addr);
        future.awaitUninterruptibly();
        IoSession session = future.getSession();
        WriteFuture wf = session.write(IoBuffer.allocate(1)).awaitUninterruptibly();
        assertNotNull(wf.getException());
View Full Code Here

        bind(true);
        IoConnector connector = newConnector();
        IoSession[] sessions = new IoSession[5];
        connector.setHandler(new IoHandlerAdapter());
        for (int i = 0; i < sessions.length; i++) {
            ConnectFuture future = connector.connect(createSocketAddress(port));
            future.awaitUninterruptibly();
            sessions[i] = future.getSession();
            assertTrue(sessions[i].isConnected());
            assertTrue(sessions[i].write(IoBuffer.allocate(1)).awaitUninterruptibly().isWritten());
        }
View Full Code Here

        bind(true);
        IoConnector connector = newConnector();
        IoSession session = null;
        connector.setHandler(new IoHandlerAdapter());
       
        ConnectFuture future = connector.connect(createSocketAddress(port));
        future.awaitUninterruptibly();
        session = future.getSession();
        assertTrue(session.isConnected());
        assertTrue(session.write(IoBuffer.allocate(1)).awaitUninterruptibly().isWritten());
View Full Code Here

       
        // Rebind
        bind(true);
       
        // Check again the connection
        future = connector.connect(createSocketAddress(port));
        future.awaitUninterruptibly();
        session = future.getSession();
        assertTrue(session.isConnected());
        assertTrue(session.write(IoBuffer.allocate(1)).awaitUninterruptibly().isWritten());
View Full Code Here

                public void sessionClosed(IoSession session) throws Exception {
                    latch.countDown();
                }
            });
           
            ConnectFuture future = connector.connect(new InetSocketAddress("localhost", port));
            future.awaitUninterruptibly();
           
            IoSession session = future.getSession();
            session.write(file);
           
View Full Code Here

                @Override
                public void exceptionCaught(IoSession session, Throwable cause) {
                    buf.append("X");
                }
            });
            ConnectFuture future = connector.connect(new InetSocketAddress(
                    "localhost", port));
            future.awaitUninterruptibly();
            buf.append("3");
            future.getSession().close(true);
            // sessionCreated() will fire before the connect future completes
View Full Code Here

                buf.append("Z");
            }
        });
       
        try {
            ConnectFuture future = connector.connect(new InetSocketAddress(
                    "localhost", port));
            future.awaitUninterruptibly();
            buf.append("1");
            try {
                future.getSession().close(true);
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.