private void cancelTimeoutAndLog(@Nullable Throwable cause, boolean cancel) {
        final ClientRequestContextExtension ctxExtension = ctx.as(ClientRequestContextExtension.class);
        if (ctxExtension != null) {
            // best-effort attempt to cancel the scheduled timeout task so that RequestContext#cause
            // isn't set unnecessarily
            ctxExtension.responseCancellationScheduler().cancelScheduled();
        }

        if (cancel) {
            cancelAction(cause);
            return;
        }

        // don't log if the cause will be exposed via the response/log
        if (delegate.isOpen() && closeAction(cause)) {
            return;
        }

        // the context has been cancelled either by timeout or by user invocation
        if (cause == ctx.cancellationCause()) {
            return;
        }

        if (cause == null || !logger.isWarnEnabled() || Exceptions.isExpected(cause)) {
            return;
        }

        logger.warn(UNEXPECTED_EXCEPTION_MSG, ctx, cause);
    }
This method is called when the delegate is completed.
core/src/main/java/com/linecorp/armeria/client/HttpResponseWrapper.java