@Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        // Not handling an upgrade request yet. Check if we received a new upgrade request.
        if (msg instanceof HttpRequest) {
            final HttpRequest req = (HttpRequest) msg;
            if (req.headers().contains(HttpHeaderNames.UPGRADE) && upgrade(ctx, req)) {
                handlingUpgrade = true;
                return;
            }
            if (handlingInvalidSettingsHeader) {
                return;
            }
        }

        ctx.fireChannelRead(msg);

        if (handlingUpgrade && msg instanceof LastHttpContent) {
            // The client should send a full payload body before sending HTTP/2 frames.
            // Hence, 'sourceCodec' could be lazily removed with the 'LastHttpContent'.
            // https://datatracker.ietf.org/doc/html/rfc7540#section-3.2
            sourceCodec.upgradeFrom(ctx);
            ctx.fireChannelReadComplete();
            ctx.pipeline().remove(this);
        }
    }
Constructs the upgrader with the supported codecs.

@param sourceCodec the codec that is being used initially
@param upgradeCodecFactory the factory that creates a new upgrade codec
                           for one of the requested upgrade protocols
core/src/main/java/com/linecorp/armeria/server/HttpServerUpgradeHandler.java