DefaultHttpRequestDuplicator extends DefaultStreamMessageDuplicator<HttpObject> implements HttpRequestDuplicator { @Override public HttpRequest duplicate() { return duplicate(headers); } DefaultHttpRequestDuplicator(HttpRequest req, EventExecutor executor, long maxRequestLength); @Override HttpRequest duplicate(); @Override HttpRequest duplicate(RequestHeaders newHeaders);  }
@Test void aggregateTwice() { final AggregatedHttpRequest aReq = AggregatedHttpRequest.of( HttpMethod.PUT, "/foo", PLAIN_TEXT_UTF_8, HttpData.ofUtf8("bar"), HttpHeaders.of(CONTENT_MD5, "37b51d194a7513e45b56f6524f2d51f2")); final HttpRequest publisher = aReq.toHttpRequest(); final HttpRequestDuplicator reqDuplicator = publisher.toDuplicator(); final AggregatedHttpRequest req1 = reqDuplicator.duplicate().aggregate().join(); final AggregatedHttpRequest req2 = reqDuplicator.duplicate().aggregate().join(); assertThat(req1.headers()).isEqualTo( RequestHeaders.of(HttpMethod.PUT, "/foo", HttpHeaderNames.CONTENT_TYPE, PLAIN_TEXT_UTF_8, CONTENT_LENGTH, 3)); assertThat(req1.content()).isEqualTo(HttpData.of(StandardCharsets.UTF_8, "bar")); assertThat(req1.trailers()).isEqualTo( HttpHeaders.of(CONTENT_MD5, "37b51d194a7513e45b56f6524f2d51f2")); assertThat(req2.headers()).isEqualTo( RequestHeaders.of(HttpMethod.PUT, "/foo", HttpHeaderNames.CONTENT_TYPE, PLAIN_TEXT_UTF_8, CONTENT_LENGTH, 3)); assertThat(req2.content()).isEqualTo(HttpData.of(StandardCharsets.UTF_8, "bar")); assertThat(req2.trailers()).isEqualTo( HttpHeaders.of(CONTENT_MD5, "37b51d194a7513e45b56f6524f2d51f2")); reqDuplicator.close(); }