@Override
    public void channelInactive(ChannelHandlerContext ctx) throws Exception {
        isAcquirable = false;

        // Protocol upgrade has failed, but needs to retry.
        if (retryProtocol != null) {
            assert responseDecoder == null || !responseDecoder.hasUnfinishedResponses();
            if (sessionTimeoutFuture != null) {
                sessionTimeoutFuture.cancel(false);
            }
            if (proxyDestinationAddress != null) {
                channelPool.connect(proxyDestinationAddress, retryProtocol, serializationFormat,
                                    poolKey, sessionPromise, null);
            } else {
                channelPool.connect(remoteAddress, retryProtocol, serializationFormat, poolKey, sessionPromise,
                                    null);
            }
        } else {
            // Fail all pending responses.
            final HttpResponseDecoder responseDecoder = this.responseDecoder;
            final Throwable pendingException;
            if (responseDecoder != null && responseDecoder.hasUnfinishedResponses()) {
                pendingException = newClosedSessionException(ctx);
                responseDecoder.failUnfinishedResponses(pendingException);
            } else {
                pendingException = null;
            }

            // Cancel the timeout and reject the sessionPromise just in case the connection has been closed
            // even before the session protocol negotiation is done.
            tryFailSessionPromise(pendingException != null ? pendingException
                                                           : newClosedSessionException(ctx));
        }
    }
Tries to complete the {@link #sessionPromise} if the session is ready to serve.

@return {@code true} if the {@link #sessionPromise} has been completed successfully or exceptionally.
        {@code false} if the {@link #sessionPromise} is still incomplete.
core/src/main/java/com/linecorp/armeria/client/HttpSessionHandler.java