Package org.jboss.netty.channel

Examples of org.jboss.netty.channel.ChannelFuture.await()


            bootstrap.setOption("connectTimeoutMillis", connectTimeout.toMillis());
        }

        bootstrap.setPipelineFactory(new NiftyClientChannelPipelineFactory(maxFrameSize));
        ChannelFuture f = bootstrap.connect(addr);
        f.await();
        Channel channel = f.getChannel();
        if (f.getCause() != null) {
            String message = String.format("unable to connect to %s:%d %s",
                    addr.getHostName(),
                    addr.getPort(),
View Full Code Here


            {
               while (true)
               {
                  try
                  {
                     boolean ok = future.await(10000);

                     if (!ok)
                     {
                        NettyConnection.log.warn("Timed out waiting for packet to be flushed");
                     }
View Full Code Here

    private void doSSLHandshake(SslHandler sslHandler) {
        log.debug("performing SSL handshake");
        ChannelFuture handshakeFuture = sslHandler.handshake();

        try {
            handshakeFuture.await();
        } catch (InterruptedException e) {
            throw new ConnectionException("Interrupted while performing SSL handshake");
        }

        if (!handshakeFuture.isSuccess()) {
View Full Code Here

            /* Perform connection */
            ChannelFuture future = bootstrap.connect(socketAddress);

            log.debug("connecting");

            future.await();

            if (future.isSuccess()) {
                /* This await should be very brief */
                connectedLatch.await();

View Full Code Here

    if (channel != null) {

      final ChannelFuture cf = channel.close();

      try {
        cf.await();
      } catch (final InterruptedException e) {
        log.warn("# terminate: channel.close() channel interrupted");
      } finally {
        log.warn("# terminate: channel.close() complete");
        channel = null;
View Full Code Here

    if (channel != null) {

      final ChannelFuture cf = channel.close();

      try {
        cf.await();
      } catch (final InterruptedException e) {
        log.warn("# terminate: channel.close() channel interrupted");
      } finally {
        log.warn("# terminate: channel.close() complete");
        channel = null;
View Full Code Here

    if (channel != null) {

      final ChannelFuture cf = channel.close();

      try {
        cf.await();
      } catch (final InterruptedException e) {
        log.warn("# terminate: channel.close() channel interrupted");
      } finally {
        log.warn("# terminate: channel.close() complete");
        channel = null;
View Full Code Here

        ClientBootstrap bootstrap = createClientBootstrap(socksProxyAddress);
        bootstrap.setOptions(configBuilder.getOptions());
        bootstrap.setOption("connectTimeoutMillis", (long) connectTimeout.toMillis());
        bootstrap.setPipelineFactory(new NiftyClientChannelPipelineFactory(maxFrameSize));
        ChannelFuture f = bootstrap.connect(addr);
        f.await();
        Channel channel = f.getChannel();
        if (f.getCause() != null) {
            String message = String.format("unable to connect to %s:%d %s",
                    addr.getHostName(),
                    addr.getPort(),
View Full Code Here

  private ProcedureResponse.Writer write(ChannelBuffer buffer) throws IOException {
    try {
      ChannelFuture result = Channels.write(channel, new DefaultHttpChunk(buffer));
      result.addListener(ChannelFutureListener.CLOSE_ON_FAILURE);
      result.await();

      if (!result.isSuccess()) {
        if (result.isCancelled()) {
          throw new IOException("Write operation cancelled.");
        }
View Full Code Here

      httpResponse.setContent(channelBuffer);
      httpResponse.setHeader(HttpHeaders.Names.CONTENT_TYPE, "application/json");
      httpResponse.setHeader(HttpHeaders.Names.CONTENT_LENGTH, channelBuffer.readableBytes());
      ChannelFuture result = channel.write(httpResponse);
      result.addListener(ChannelFutureListener.CLOSE);
      result.await();
    } catch (Throwable t) {
      throw new IOException(t);
    } finally {
      writer = ResponseWriters.CLOSED_WRITER;
    }
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.