private CancellationTask newCancellationTask() {
        return new CancellationTask() {
            @Override
            public boolean canSchedule() {
                return delegate.isOpen() && !done;
            }

            @Override
            public void run(Throwable cause) {
                if (ctx.eventLoop().inEventLoop()) {
                    try (SafeCloseable ignored = RequestContextUtil.pop()) {
                        close(cause);
                    }
                } else {
                    ctx.eventLoop().withoutContext().execute(() -> close(cause));
                }
            }
        };
    }
This method is called when the delegate is completed.
core/src/main/java/com/linecorp/armeria/client/HttpResponseWrapper.java