Package org.jboss.netty.bootstrap

Examples of org.jboss.netty.bootstrap.ClientBootstrap.connect()


        // Set up the event pipeline factory.
        bootstrap.setPipelineFactory(new FactorialClientPipelineFactory(count));

        // Make a new connection.
        ChannelFuture connectFuture =
            bootstrap.connect(new InetSocketAddress(host, port));

        // Wait until the connection is made successfully.
        Channel channel = connectFuture.awaitUninterruptibly().getChannel();

        // Get the handler instance to retrieve the answer.
View Full Code Here


        // Set up the event pipeline factory.
        bootstrap.setPipelineFactory(new HttpClientPipelineFactory(ssl));

        // Start the connection attempt.
        ChannelFuture future = bootstrap.connect(new InetSocketAddress(host, port));

        // Wait until the connection attempt succeeds or fails.
        Channel channel = future.awaitUninterruptibly().getChannel();
        if (!future.isSuccess()) {
            future.getCause().printStackTrace();
View Full Code Here

        inboundChannel.setReadable(false);

        // Start the connection attempt.
        ClientBootstrap cb = new ClientBootstrap(cf);
        cb.getPipeline().addLast("handler", new OutboundHandler(e.getChannel()));
        ChannelFuture f = cb.connect(new InetSocketAddress(remoteHost, remotePort));

        outboundChannel = f.getChannel();
        f.addListener(new ChannelFutureListener() {
            public void operationComplete(ChannelFuture future) throws Exception {
                if (future.isSuccess()) {
View Full Code Here

    });
  }
});
   
     // Start the connection attempt.
    ChannelFuture future = bootstrap.connect(new InetSocketAddress("localhost", 8080));
    // Wait until the connection attempt succeeds or fails.
    Channel channel = future.awaitUninterruptibly().getChannel();
    if (future.isSuccess())
      System.out.println("connected");
   
View Full Code Here

          HessianProxyFactory factory = new HessianProxyFactory(executor, host.getName()+":"+host.getPort());
          bootstrap.setPipelineFactory(
                  new RPCClientPipelineFactory(executor, factory));
         
           // Start the connection attempt.
          ChannelFuture future = bootstrap.connect(new InetSocketAddress(host.getName(), host.getPort()));
          try
        {
          future.await(10000);
          connected = future.isSuccess();
View Full Code Here

          HessianProxyFactory factory = new HessianProxyFactory(executor, host.getName()+":"+host.getPort());
          bootstrap.setPipelineFactory(
                  new RPCClientPipelineFactory(executor, factory));
         
           // Start the connection attempt.
          ChannelFuture future = bootstrap.connect(new InetSocketAddress(host.getName(), host.getPort()));
          try
        {
          future.await(10000);
          connected = future.isSuccess();
View Full Code Here

                    }

                });
            }
        });
        bootstrap.connect(new InetSocketAddress(port));
    }

    /**
     * {@inheritedDoc}
     */
 
View Full Code Here

        return Channels.pipeline(new LoggingHandler(InternalLogLevel.DEBUG),
            new HttpClientCodec(), new LoggingHandler(InternalLogLevel.DEBUG),
            responseHandler);
      }
    });
    final ChannelFuture connectFuture = client.connect(new InetSocketAddress(
        "localhost", port));
    return connectFuture;
  }

  static Channel createClientBootstrap(final GenericHttpResponseHandler responseHandler,int port)
View Full Code Here

    //ckpt.setCatchupSource("foo");
    String uristr = "/stream?sources=105&output=json&size=" + fetchSize + "&streamFromLatestScn=false&checkPoint=" + ckpt.toString();
    ClientBootstrap bootstrap = new ClientBootstrap(new NioClientSocketChannelFactory(Executors.newCachedThreadPool(),
                                                                                      Executors.newCachedThreadPool()));
    bootstrap.setPipelineFactory(new HttpClientPipelineFactory(handler));
    ChannelFuture future = bootstrap.connect(new InetSocketAddress("localhost", relayPort));
    Channel channel = future.awaitUninterruptibly().getChannel();
    Assert.assertTrue(future.isSuccess(), "Cannot connect to relay at localhost:" + relayPort);
    HttpRequest request  = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uristr);
    request.setHeader(HttpHeaders.Names.HOST, "localhost");
    channel.write(request);
View Full Code Here

      // Phew. Ok. We built all that. Now what ?
      InetSocketAddress addressToConnectTo = new InetSocketAddress("localhost", 8080);
      //ChannelFuture cf = bootstrap.connect(addressToConnectTo);
      clog("Issuing Channel Connect...");
      // Waiting on a connect. (Pick one)
      ChannelFuture cf = bootstrap.connect(addressToConnectTo);
      // wait interruptibly
//      cf.await();
      // wait interruptibly with a timeout of 2000 ms.
//      cf.await(2000, TimeUnit.MILLISECONDS);
      // wait uninterruptibly
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.