@Override
        public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
            if (msg instanceof HttpResponse) {
                // The server rejected the upgrade request and sent its response in HTTP/1.
                assert upgradeEvt == UPGRADE_REJECTED;
                final HttpResponse res = (HttpResponse) msg;
                upgradeRejectionCause = "Upgrade request rejected with: " + res;
                // We can persist connection only when:
                // - The response has 'Connection: keep-alive' header on HTTP/1.0.
                // - The response has no 'Connection: close' header on HTTP/1.1.
                // and:
                // - The response has 'Content-Length' or 'Transfer-Encoding: chunked',
                //   i.e. possible to determine the end of the response.
                //
                // See: https://datatracker.ietf.org/doc/html/rfc2616#section-8.1.2.1
                //      https://datatracker.ietf.org/doc/html/rfc2616#section-4.4
                needsToClose = !(HttpUtil.isKeepAlive(res) &&
                                 (HttpUtil.isContentLengthSet(res) ||
                                  HttpUtil.isTransferEncodingChunked(res)));
                if (needsToClose) {
                    // No need to wait till the end of the response.
                    // Close the connection immediately and finish the upgrade process.
                    onUpgradeResponse(ctx, false);
                }

                ReferenceCountUtil.release(msg);
                return;
            }

            // We're not going to reuse the connection,
            // so we just discard everything received.
            if (needsToClose) {
                ReferenceCountUtil.release(msg);
                return;
            }

            // We're not going to close but reuse the connection,
            // so we wait until the end of the rejecting response.
            if (msg instanceof HttpContent) {
                if (msg instanceof LastHttpContent) {
                    onUpgradeResponse(ctx, false);
                }
                ReferenceCountUtil.release(msg);
                return;
            }

            ctx.fireChannelRead(msg);
        }
Keeps the upgrade result in {@link #upgradeEvt}.
core/src/main/java/com/linecorp/armeria/client/HttpClientPipelineConfigurator.java