         return promise.futureResult
     }
     
+    /// Remove a `ChannelHandlerContext` from the `ChannelPipeline`. Must only be called from within the `EventLoop`.
     private func remove0(_ fn: @escaping ((ChannelHandlerContext) -> Bool)) -> EventLoopFuture<Bool> {
         let promise: EventLoopPromise<Bool> = eventLoop.newPromise()
         if eventLoop.inEventLoop {

        }
    }
    
    public func remove(handler: ChannelHandler) -> EventLoopFuture<Bool> {
        return remove0({ $0.handler === handler })
    }
    
    public func remove(name: String) -> EventLoopFuture<Bool> {
        return remove0({ $0.name == name })
    }
    
    public func remove(ctx: ChannelHandlerContext) -> EventLoopFuture<Bool> {
        return remove0({ $0 === ctx })
    }
    
    public func context(handler: ChannelHandler) -> EventLoopFuture<ChannelHandlerContext> {
        return context0({ $0.handler === handler })
    }
    
    public func context(name: String) -> EventLoopFuture<ChannelHandlerContext> {
        return context0({ $0.name == name })
    }
    
    public func context(ctx: ChannelHandlerContext) -> EventLoopFuture<ChannelHandlerContext> {
        return context0({ $0 === ctx })
    }
    
    private func context0(_ fn: @escaping ((ChannelHandlerContext) -> Bool)) -> EventLoopFuture<ChannelHandlerContext> {
        let promise: EventLoopPromise<ChannelHandlerContext> = eventLoop.newPromise()
        

    private var idx: Int = 0
    private var destroyed: Bool = false
    
    /// The `EventLoop` that is used by the underlying `Channel`.
    public var eventLoop: EventLoop {
        return channel.eventLoop
    }

    /// The `Channel` that this `ChannelPipeline` belongs to.
    public unowned let channel: Channel

    /// Add a `ChannelHandler` to the `ChannelPipeline`.
    ///
    /// - parameters:
    ///     - name: the name to use for the `ChannelHandler` when its added. If none is specified it will generate a name.
    ///     - handler: the `ChannelHandler` to add
    ///     - first: `true` to add this handler to the front of the `ChannelPipeline`, `false to add it last
    /// - returns: the `EventLoopFuture` which will be notified once the `ChannelHandler` was added.
    public func add(name: String? = nil, handler: ChannelHandler, first: Bool = false) -> EventLoopFuture<Void> {
        let promise: EventLoopPromise<Void> = eventLoop.newPromise()
        if eventLoop.inEventLoop {
