private void removeSelfIfPresent(ChannelHandlerContext ctx) {
        ChannelPipeline pipeline = ctx.pipeline();
        if (!ctx.isRemoved()) {
            pipeline.remove(this);
        }
    }
this method is inspired by ApplicationProtocolNegotiationHandler.userEventTriggered
zuul-core/src/main/java/com/netflix/zuul/netty/server/http2/Http2OrHttpHandler.java