@Test
    void shouldNotDelegateIfCompletedExceptionallyAlready() {
        final Exception originalCause = new Exception();

        final CompletableFuture<HttpResponse> completedFuture = new CompletableFuture<>();
        completedFuture.completeExceptionally(originalCause);

        final HttpResponse res1 = HttpResponse.of(completedFuture);
        final HttpResponse res2 = HttpResponse.of((CompletionStage<? extends HttpResponse>) completedFuture);
        assertThat(res1).isInstanceOf(AbortedHttpResponse.class);
        // CompletionStage does not provide the current state.
        assertThat(res2).isNotInstanceOf(AbortedHttpResponse.class);
        assertThatThrownBy(() -> res1.collect().join()).hasCause(originalCause);
        assertThatThrownBy(() -> res2.collect().join()).hasCause(originalCause);
    }
When the given future is already complete exceptionally, we should not wrap it with
{@link DeferredHttpResponse} but just return the failed response directly.
core/src/test/java/com/linecorp/armeria/common/DeferredHttpResponseTest.java