@SuppressWarnings("unchecked")
    private static <U extends AggregatedHttpMessage> U aggregate(List<HttpObject> objects,
                                                                 @Nullable RequestHeaders headers,
                                                                 @Nullable ByteBufAllocator allocator) {
        if (headers != null) {
            return (U) HttpMessageAggregator.aggregateRequest(headers, objects, allocator);
        } else {
            return (U) HttpMessageAggregator.aggregateResponse(objects, allocator);
        }
    }
Aggregates an {@link HttpMessage} into an {@link AggregatedHttpMessage} using
the specified {@link AggregationOptions}.

<p>Note that this method is added for internal usage. Therefore, you <strong>must not</strong> override
or call this method if you are not familiar with Armeria's internal implementation.
core/src/main/java/com/linecorp/armeria/common/stream/AggregationSupport.java