private static HttpResponse sendResponseAfterAggregate(HttpRequest req,
    AggregatedHttpResponse response) {
    final CompletableFuture<HttpResponse> future = new CompletableFuture<>();
    req.aggregate().whenComplete((aggregatedReq, cause) -> {
      if (cause != null) {
        future.completeExceptionally(cause);
      } else {
        future.complete(response.toHttpResponse());
      }
    });
    return HttpResponse.from(future);
  }
This ensures the response is sent after the request is fully read.
zipkin-server/src/test/java/zipkin2/server/internal/elasticsearch/ITElasticsearchHealthCheck.java