Package org.apache.mina.transport.socket.nio

Examples of org.apache.mina.transport.socket.nio.SocketConnector.connect()


        // Set connect timeout.
        ( ( IoConnectorConfig ) connector.getDefaultConfig()).setConnectTimeout( 30 );
       
        // Start communication.
        connector.connect(
                new InetSocketAddress( args[ 0 ],
                Integer.parseInt( args[ 1 ] ) ),
                new NetCatProtocolHandler() );
    }
}
View Full Code Here


    String processors = getProperty("pastrybroker.maxprocessors", "5");
    SocketConnector clientConnector = new SocketConnector(Integer
        .parseInt(processors), Executors.newCachedThreadPool());
    log.info("Connecting to local broker...");
    ConnectFuture connectFuture = clientConnector.connect(LOCAL_ADDRESS,
        new IoHandlerAdapter() {
          public void messageReceived(IoSession session, Object msg) {
            context = (PastryContext) msg;
            log.info("Pastry context retrieved");
          }
View Full Code Here

        // Set connect timeout.
        ((IoConnectorConfig) connector.getDefaultConfig())
                .setConnectTimeout(30);

        // Start communication.
        ConnectFuture cf = connector.connect(new InetSocketAddress(
                args[0], Integer.parseInt(args[1])), new NetCatProtocolHandler());
       
        // Wait for the connection attempt to be finished.
        cf.join();
        cf.getSession();
View Full Code Here

       
        synchronized( sender.lock )
        {
            synchronized( receiver.lock )
            {
                connector.connect( address, receiver );
               
                sender.lock.wait();
                receiver.lock.wait();
            }
        }
View Full Code Here

        // Set connect timeout.
        connector.setConnectTimeout( 30 );
       
        // Start communication.
        connector.connect(
                new InetSocketAddress( args[ 0 ],
                Integer.parseInt( args[ 1 ] ) ),
                new NetCatProtocolHandler() );
    }
}
View Full Code Here

        IoSession session;
        for( ;; )
        {
            try
            {
                ConnectFuture future = connector.connect(
                        new InetSocketAddress( HOSTNAME, PORT ),
                        new ClientSessionHandler( USE_CUSTOM_CODEC, values ) );
               
                future.join();
                session = future.getSession();
View Full Code Here

        acceptor.bind(address, sender);

        synchronized (sender.lock) {
            synchronized (receiver.lock) {
                connector.connect(address, receiver);

                sender.lock.wait();
                receiver.lock.wait();
            }
        }
View Full Code Here

        // Set connect timeout.
        ((IoConnectorConfig) connector.getDefaultConfig())
                .setConnectTimeout(30);

        // Start communication.
        connector.connect(new InetSocketAddress(args[0], Integer
                .parseInt(args[1])), new NetCatProtocolHandler());
    }
}
View Full Code Here

        cfg.getFilterChain().addLast("logger", new LoggingFilter());

        IoSession session;
        for (;;) {
            try {
                ConnectFuture future = connector.connect(new InetSocketAddress(
                        HOSTNAME, PORT), new ClientSessionHandler(values), cfg);

                future.join();
                session = future.getSession();
                break;
View Full Code Here

    SocketConnectorConfig config = new SocketConnectorConfig();
    SocketSessionConfig sessionConf =
      (SocketSessionConfig) config.getSessionConfig();
    sessionConf.setTcpNoDelay(true);
    while (true) {
      ConnectFuture future = connector.connect(new InetSocketAddress(server, port), ioHandlerWrapper, config);
      future.join();
      if (future.isConnected()) {
        break;
      }
      try {
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.