@Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
        if (cause instanceof ProxyConnectException) {
            final SessionProtocol protocol = this.protocol != null ? this.protocol : desiredProtocol;
            final UnprocessedRequestException wrapped = UnprocessedRequestException.of(cause);
            channelPool.maybeHandleProxyFailure(protocol, poolKey, wrapped);
            tryFailSessionPromise(wrapped);
            return;
        }
        setPendingException(ctx, new ClosedSessionException(cause));
        if (!(cause instanceof IOException)) {
            ctx.close();
        } else {
            // Netty will close the connection automatically on an IOException.
        }
    }
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