private void onUpgradeResponse(ChannelHandlerContext ctx, boolean success) {
            final UpgradeEvent upgradeEvt = this.upgradeEvt;
            assert upgradeEvt != null : "received an upgrade response before an UpgradeEvent";
            final ChannelPipeline p = ctx.pipeline();

            // Done with this handler, remove it from the pipeline.
            p.remove(this);

            if (needsToClose) {
                // Server wants us to close the connection, which means we cannot use this connection
                // to send the request that contains the actual invocation.
                SessionProtocolNegotiationCache.setUnsupported(remoteAddress(ctx), http2);

                if (httpPreference == HttpPreference.HTTP2_REQUIRED) {
                    finishWithNegotiationFailure(ctx, http2, http1, upgradeRejectionCause);
                } else {
                    // We can silently retry with H1C.
                    retryWith(ctx, http1);
                }
                return;
            }

            if (success) {
                finishSuccessfully(p, http2);
            } else {
                SessionProtocolNegotiationCache.setUnsupported(remoteAddress(ctx), http2);

                if (httpPreference == HttpPreference.HTTP2_REQUIRED) {
                    finishWithNegotiationFailure(ctx, http2, http1, upgradeRejectionCause);
                    return;
                }

                finishSuccessfully(p, http1);
            }
        }
Keeps the upgrade result in {@link #upgradeEvt}.
core/src/main/java/com/linecorp/armeria/client/HttpClientPipelineConfigurator.java