private static void CloseOnFlush(IO.Netty.Channel.Channel ch)
 {
     if (ch.IsActive())
     {
         ch.WriteAndFlush(Unpooled.EmptyBuffer).AddListener(ChannelFutureListener.Close);
     }
 }
 public override void ChannelInactive(ChannelHandlerContext ctx)
 {
     if (proxiedChannel != null)
     {
         proxiedChannel.Close();
         proxiedChannel = null;
     }
 }
 public _ChannelFutureListener_115(SimpleHttpProxyHandler _enclosing, ChannelHandlerContext
                                   ctx, HttpRequest req, IO.Netty.Channel.Channel client)
 {
     this._enclosing = _enclosing;
     this.ctx        = ctx;
     this.req        = req;
     this.client     = client;
 }
 public override void ExceptionCaught(ChannelHandlerContext ctx, Exception cause)
 {
     Log.Info("Proxy for " + uri + " failed. cause: ", cause);
     if (proxiedChannel != null)
     {
         proxiedChannel.Close();
         proxiedChannel = null;
     }
     ctx.Close();
 }
        public virtual void InitServer(string fsimage)
        {
            FSImageLoader loader = FSImageLoader.Load(fsimage);

            bootstrap.ChildHandler(new _ChannelInitializer_92(this, loader));
            channel = bootstrap.Bind(address).Sync().Channel();
            allChannels.AddItem(channel);
            address = (IPEndPoint)channel.LocalAddress();
            Log.Info("WebImageViewer started. Listening on " + address.ToString() + ". Press Ctrl+C to stop the viewer."
                     );
        }
        protected override void ChannelRead0(ChannelHandlerContext ctx, HttpRequest req)
        {
            uri = req.GetUri();
            IO.Netty.Channel.Channel     client        = ctx.Channel();
            IO.Netty.Bootstrap.Bootstrap proxiedServer = new IO.Netty.Bootstrap.Bootstrap().Group
                                                             (client.EventLoop()).Channel(typeof(NioSocketChannel)).Handler(new _ChannelInitializer_106
                                                                                                                                (this, client));
            ChannelFuture f = proxiedServer.Connect(host);

            proxiedChannel = f.Channel();
            f.AddListener(new _ChannelFutureListener_115(this, ctx, req, client));
        }
 private Forwarder(string uri, IO.Netty.Channel.Channel client)
 {
     this.uri    = uri;
     this.client = client;
 }
 public _ChannelInitializer_106(SimpleHttpProxyHandler _enclosing, IO.Netty.Channel.Channel
                                client)
 {
     this._enclosing = _enclosing;
     this.client     = client;
 }