DefaultHttpResponseDuplicator extends DefaultStreamMessageDuplicator<HttpObject> implements HttpResponseDuplicator { @Override public HttpResponse duplicate() { return new DuplicatedHttpResponse(super.duplicate()); } DefaultHttpResponseDuplicator(HttpResponse res, EventExecutor executor, long maxResponseLength); @Override HttpResponse duplicate();  }
@Test void aggregateTwice() { final HttpResponseWriter publisher = HttpResponse.streaming(); final HttpResponseDuplicator resDuplicator = publisher.toDuplicator(); publisher.write(ResponseHeaders.of(HttpStatus.OK, HttpHeaderNames.CONTENT_TYPE, MediaType.PLAIN_TEXT_UTF_8)); publisher.write(HttpData.ofUtf8("Armeria ")); publisher.write(HttpData.ofUtf8("is ")); publisher.write(HttpData.ofUtf8("awesome!")); publisher.close(); final AggregatedHttpResponse res1 = resDuplicator.duplicate().aggregate().join(); final AggregatedHttpResponse res2 = resDuplicator.duplicate().aggregate().join(); assertThat(res1.status()).isEqualTo(HttpStatus.OK); assertThat(res1.contentType()).isEqualTo(MediaType.PLAIN_TEXT_UTF_8); assertThat(res1.headers().get(VARY)).isNull(); assertThat(res1.contentUtf8()).isEqualTo("Armeria is awesome!"); assertThat(res2.status()).isEqualTo(HttpStatus.OK); assertThat(res2.contentType()).isEqualTo(MediaType.PLAIN_TEXT_UTF_8); assertThat(res2.headers().get(VARY)).isNull(); assertThat(res2.contentUtf8()).isEqualTo("Armeria is awesome!"); resDuplicator.close(); }