public void OperationComplete(ChannelFuture future)
 {
     if (future.IsSuccess())
     {
         ctx.Channel().Read();
     }
     else
     {
         SimpleHttpProxyHandler.Log.Debug("Proxy failed. Cause: ", future.Cause());
         future.Channel().Close();
     }
 }
 /// <exception cref="System.Exception"/>
 public void OperationComplete(ChannelFuture future)
 {
     if (future.IsSuccess())
     {
         ctx.Channel().Pipeline().Remove <HttpResponseEncoder>();
         HttpRequest newReq = new DefaultFullHttpRequest(HttpVersion.Http11, req.GetMethod
                                                             (), req.GetUri());
         newReq.Headers().Add(req.Headers());
         newReq.Headers().Set(HttpHeaders.Names.Connection, HttpHeaders.Values.Close);
         future.Channel().WriteAndFlush(newReq);
     }
     else
     {
         DefaultHttpResponse resp = new DefaultHttpResponse(HttpVersion.Http11, HttpResponseStatus
                                                            .InternalServerError);
         resp.Headers().Set(HttpHeaders.Names.Connection, HttpHeaders.Values.Close);
         SimpleHttpProxyHandler.Log.Info("Proxy " + this._enclosing.uri + " failed. Cause: "
                                         , future.Cause());
         ctx.WriteAndFlush(resp).AddListener(ChannelFutureListener.Close);
         client.Close();
     }
 }