     }
 }
 
+/// Special `ChannelHandler` that forwards all events to the `Channel.Unsafe` implementation.
 private final class HeadChannelHandler : _ChannelOutboundHandler {
 
     static let sharedInstance = HeadChannelHandler()

        }
    }
    
    private func nextName() -> String {
        assert(eventLoop.inEventLoop)


        }
    }
    
    /// Remove a `ChannelHandler` from the `ChannelPipeline`.
    ///
    /// - parameters:
    ///     - handler: the `ChannelHandler` to remove.
    /// - returns: the `EventLoopFuture` which will be notified once the `ChannelHandler` was removed.
    public func remove(handler: ChannelHandler) -> EventLoopFuture<Bool> {
        return remove0({ $0.handler === handler })
    }
    
    /// Remove a `ChannelHandler` from the `ChannelPipeline`.
    ///
    /// - parameters:
    ///     - name: the name that was used to add the `ChannelHandler` to the `ChannelPipeline` before.
    /// - returns: the `EventLoopFuture` which will be notified once the `ChannelHandler` was removed.
    public func remove(name: String) -> EventLoopFuture<Bool> {
        return remove0({ $0.name == name })
    }
    
    /// Remove a `ChannelHandler` from the `ChannelPipeline`.
    ///
    /// - parameters:
    ///     - ctx: the `ChannelHandlerContext` that belongs to `ChannelHandler` that should be removed.
    /// - returns: the `EventLoopFuture` which will be notified once the `ChannelHandler` was removed.
    public func remove(ctx: ChannelHandlerContext) -> EventLoopFuture<Bool> {
        return remove0({ $0 === ctx })
    }
    
    /// Returns the `ChannelHandlerContext` that belongs to a `ChannelHandler`.
    ///
    /// - parameters:
    ///     - handler: the `ChannelHandler` for which the `ChannelHandlerContext` shoud be returned
    /// - returns: the `EventLoopFuture` which will be notified once the the operation completes.
    public func context(handler: ChannelHandler) -> EventLoopFuture<ChannelHandlerContext> {
        return context0({ $0.handler === handler })
    }
    
    /// Returns the `ChannelHandlerContext` that belongs to a `ChannelHandler`.
    ///
    /// - parameters:
    ///     - name: the name that was used to add the `ChannelHandler` to the `ChannelPipeline` before.
    /// - returns: the `EventLoopFuture` which will be notified once the the operation completes.
    public func context(name: String) -> EventLoopFuture<ChannelHandlerContext> {
        return context0({ $0.name == name })
    }

    /// Find a `ChannelHandlerContext` in the `ChannelPipeline`.
    private func context0(_ fn: @escaping ((ChannelHandlerContext) -> Bool)) -> EventLoopFuture<ChannelHandlerContext> {
        let promise: EventLoopPromise<ChannelHandlerContext> = eventLoop.newPromise()
        
