@Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
        ProtocolDetectionResult<HAProxyProtocolVersion> detectionResult =
                HAProxyMessageDecoder.detectProtocol(in);
        if (detectionResult.equals(ProtocolDetectionResult.needsMoreData())) {
            return;
        }
        ChannelPipeline pipeline = ctx.pipeline();
        if (detectionResult.equals(ProtocolDetectionResult.invalid())) {
            pipeline.remove(this);
            onRemoteAddressConfirmed.accept((InetSocketAddress) ctx.channel()
                    .remoteAddress());
        } else {
            pipeline.replace(this, NettyPipeline.ProxyProtocolDecoder, new HAProxyMessageDecoder());
            pipeline.addAfter(NettyPipeline.ProxyProtocolDecoder,
                    NettyPipeline.ProxyProtocolReader,
                    new ExtendedHAProxyMessageReader(onRemoteAddressConfirmed));
        }
    }
@author James Chen
@see {@link reactor.netty.http.server.HAProxyMessageDetector}
turms-gateway/src/main/java/im/turms/gateway/access/client/tcp/ExtendedHAProxyMessageDetector.java