@ParameterizedTest
    @ArgumentsSource(ParametersProvider.class)
    void abortedAggregation(boolean executorSpecified, boolean withPooledObjects, Throwable abortCause) {
        final Thread mainThread = Thread.currentThread();
        final DefaultHttpRequest req = new DefaultHttpRequest(RequestHeaders.of(HttpMethod.GET, "/foo"));
        final CompletableFuture<? extends AggregatedHttpRequest> future;

        // Practically same execution, but we need to test the both case due to code duplication.
        if (executorSpecified) {
            if (withPooledObjects) {
                future = req.aggregate(AggregationOptions.builder()
                                                         .usePooledObjects()
                                                         .executor(CommonPools.workerGroup().next())
                                                         .build());
            } else {
                future = req.aggregate(CommonPools.workerGroup().next());
            }
        } else {
            if (withPooledObjects) {
                future = req.aggregate(AggregationOptions.builder()
                                                         .usePooledObjects()
                                                         .build());
            } else {
                future = req.aggregate();
            }
        }

        final AtomicReference<Thread> callbackThread = new AtomicReference<>();

        if (abortCause == null) {
            assertThatThrownBy(() -> {
                final CompletableFuture<? extends AggregatedHttpRequest> f =
                        future.whenComplete((unused, cause) -> callbackThread.set(Thread.currentThread()));
                req.abort();
                f.join();
            }).hasCauseInstanceOf(AbortedStreamException.class);
        } else {
            assertThatThrownBy(() -> {
                final CompletableFuture<? extends AggregatedHttpRequest> f =
                        future.whenComplete((unused, cause) -> callbackThread.set(Thread.currentThread()));
                req.abort(abortCause);
                f.join();
            }).hasCauseInstanceOf(abortCause.getClass());
        }

        assertThat(callbackThread.get()).isNotSameAs(mainThread);
    }
The aggregation future must be completed even if the request being aggregated has been aborted.
core/src/test/java/com/linecorp/armeria/internal/common/DefaultHttpRequestTest.java