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();
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

                actual.append("A");
            }

        });

        ConnectFuture future = connector.connect(new VmPipeAddress(1));

        future.awaitUninterruptibly();
        future.getSession().getCloseFuture().awaitUninterruptibly();
        acceptor.dispose();
View Full Code Here

                    throws Exception {
                session.close();
            }
        });

        ConnectFuture future = connector.connect(new VmPipeAddress(1));

        future.awaitUninterruptibly();
        future.getSession().getCloseFuture().awaitUninterruptibly();
        acceptor.dispose();
        connector.dispose();
View Full Code Here

    @Override
    protected ConnectFuture connect(int port, IoHandler handler)
            throws Exception {
        IoConnector connector = new VmPipeConnector();
        connector.setHandler(handler);
        return connector.connect(new VmPipeAddress(port));
    }

    @Override
    protected SocketAddress createServerSocketAddress(int port) {
        return new VmPipeAddress(port);
View Full Code Here

                                fail("unexpected message received " + message);
                            }
                        }
                    });

                    ConnectFuture c2Future = c2.connect(address);

                    c2Future.await();

                    latch.await();
View Full Code Here

    @Override
    protected ConnectFuture connect(int port, IoHandler handler)
            throws Exception {
        IoConnector connector = new NioDatagramConnector();
        connector.setHandler(handler);
        return connector.connect(new InetSocketAddress("localhost", port));
    }

    @Override
    protected SocketAddress createServerSocketAddress(int port) {
        return new InetSocketAddress(port);
View Full Code Here

    @Override
    protected ConnectFuture connect(int port, IoHandler handler)
            throws Exception {
        IoConnector connector = new NioSocketConnector();
        connector.setHandler(handler);
        return connector.connect(new InetSocketAddress("localhost", port));
    }

    @Override
    protected SocketAddress createServerSocketAddress(int port) {
        return new InetSocketAddress(port);
View Full Code Here

    if (!isClient) {
      log.debug("Connecting..");
      IoConnector connector = new NioSocketConnector();
      connector.setHandler(this);
      ConnectFuture future = connector.connect(forward);
      future.awaitUninterruptibly(); // wait for connect, or timeout
      if (future.isConnected()) {
        if (log.isDebugEnabled()) {
          log.debug("Connected: {}", forward);
        }
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

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.