Package org.apache.mina.core.service

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


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

        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

        acceptor.setHandler(new IoHandlerAdapter());

        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

    @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

    @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

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

        DatagramSessionConfig cfg = ((DatagramSessionConfig) session
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.