Package org.jboss.netty.channel

Examples of org.jboss.netty.channel.ChannelFutureListener


        LOG.debug("Writing body: {}", body);
        // write the body asynchronously
        ChannelFuture future = channel.write(body);

        // add listener which handles the operation
        future.addListener(new ChannelFutureListener() {
            public void operationComplete(ChannelFuture channelFuture) throws Exception {
                LOG.debug("Operation complete {}", channelFuture);
                if (!channelFuture.isSuccess()) {
                    // no success the set the caused exception and signal callback and break
                    exchange.setException(channelFuture.getCause());
View Full Code Here


    conn = SharedObjectHelper.getClientBootstrap().connect(
            new InetSocketAddress(host, port));
    conn.getChannel().getPipeline()
            .addLast("codec", new HttpResponseDecoder());
    conn.getChannel().getPipeline().addLast("handler", this);
    conn.addListener(new ChannelFutureListener()
    {
      public void operationComplete(ChannelFuture future)
              throws Exception
      {
        if (future.isSuccess())
View Full Code Here

      logger.info("Find " + host + " for " + x);
      final InetSocketAddress remote = new InetSocketAddress(host, port);
      proxyTunnel = SharedObjectHelper.getClientBootstrap().connect(
              remote);
      proxyTunnel.getChannel().getConfig().setConnectTimeoutMillis(5000);
      proxyTunnel.addListener(new ChannelFutureListener()
      {
        public void operationComplete(ChannelFuture future)
                throws Exception
        {
          if (future.isSuccess())
View Full Code Here

  {
    if (null == channelFuture)
    {
      return false;
    }
    channelFuture.addListener(new ChannelFutureListener()
    {

      @Override
      public void operationComplete(ChannelFuture future)
              throws Exception
View Full Code Here

                .get(SslHandler.class);
    if (null != ssl)
    {
      handler.channelFuture = new DefaultChannelFuture(
              future.getChannel(), false);
      future.addListener(new ChannelFutureListener()
      {
        public void operationComplete(ChannelFuture future)
                throws Exception
        {
          if (future.isSuccess())
          {
            ssl.handshake().addListener(new ChannelFutureListener()
            {
              public void operationComplete(ChannelFuture future)
                      throws Exception
              {
                if (future.isSuccess())
View Full Code Here

 
  private void doRequest(final HttpClientHandler handler,
          final HttpRequest req, final FutureCallback cb)
  {
    handler.setCallback(cb);
    handler.channelFuture.addListener(new ChannelFutureListener()
    {
      @Override
      public void operationComplete(ChannelFuture future)
              throws Exception
      {
View Full Code Here

        public void onError(String error)
        {
          cb.onError(error);
        }
      });
      handler.channelFuture.addListener(new ChannelFutureListener()
      {
        public void operationComplete(ChannelFuture future)
                throws Exception
        {
          if (!future.isSuccess())
View Full Code Here

        }
        catch (MalformedURLException e1)
        {
          e1.printStackTrace();
        }
        proxyTunnel.addListener(new ChannelFutureListener()
        {
          public void operationComplete(ChannelFuture future)
                  throws Exception
          {
            if (!future.isSuccess())
            {
              byte[] failed = "HTTP/1.1 503 Service Unavailable\r\n\r\n"
                      .getBytes();
              local.handleRawData(GoogleRemoteHandler.this,
                      ChannelBuffers.wrappedBuffer(failed));
            }
            else
            {
              ChannelPipeline pipeline = future.getChannel()
                      .getPipeline();
              pipeline.addLast("encoder",
                      new HttpRequestEncoder());
              future.getChannel().write(req);
             
            }
          }
        });
      }
      else
      {
        String remoteHost = HostsService
                .getMappingHost(GoogleConfig.googleHttpsHostAlias);
       
        proxyTunnel = SharedObjectHelper.getClientBootstrap().connect(
                new InetSocketAddress(remoteHost, 443));
        proxyTunnel.addListener(new ChannelFutureListener()
        {
          public void operationComplete(ChannelFuture future)
                  throws Exception
          {
            if (future.isSuccess())
View Full Code Here

      {
        close();
        return;
      }
      local.getLocalChannel().write(establised)
              .addListener(new ChannelFutureListener()
              {
                public void operationComplete(ChannelFuture future)
                        throws Exception
                {
                  if (future.isDone())
View Full Code Here

        if (logger.isDebugEnabled()) {
            logger.debug("Writing a Consume request to channel: {} with messageSeqId: {} for {}",
                         va(channel, messageSeqId, topicSubscriber));
        }
        ChannelFuture future = channel.write(pubsubRequestBuilder.build());
        future.addListener(new ChannelFutureListener() {
            @Override
            public void operationComplete(ChannelFuture future) throws Exception {
                if (!future.isSuccess()) {
                    logger.error("Error writing a Consume request to channel: {} with messageSeqId: {} for {}",
                                 va(channel, messageSeqId, topicSubscriber));
View Full Code Here

TOP

Related Classes of org.jboss.netty.channel.ChannelFutureListener

Copyright © 2018 www.massapicom. 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.