code: public static <T> HttpResponseWriter streamingFrom(Stream<T> stream,
                                                         HttpHeaders headers, HttpHeaders trailingHeaders,
                                                         Function<T, HttpData> contentConverter,
                                                         Executor executor) {
          requireNonNull(stream, "stream");
          requireNonNull(headers, "headers");
          requireNonNull(trailingHeaders, "trailingHeaders");
          requireNonNull(contentConverter, "contentConverter");
          requireNonNull(executor, "executor");
  
          final HttpResponseWriter writer = HttpResponse.streaming();
          executor.execute(() -> {
              try {
                  final Iterator<T> it = stream.sequential().iterator();
                  boolean headerSent = false;
                  while (it.hasNext()) {
                      final HttpData content = contentConverter.apply(it.next());
                      if (!headerSent) {
                          writer.write(headers);
                          headerSent = true;
                      }
                      writer.write(content);
                  }
                  if (!trailingHeaders.isEmpty()) {
                      writer.write(trailingHeaders);
                  }
                  writer.close();
              } catch (Exception e) {
                  writer.close(e);
              }
          });
          return writer;
      }
docs: Returns a new {@link HttpResponseWriter} which sends a streaming response from the specified
  {@link Stream}.
  
  @param stream a sequence of objects
  @param headers to be written to the returned {@link HttpResponseWriter}
  @param trailingHeaders to be written to the returned {@link HttpResponseWriter}
  @param contentConverter converts the published objects into streaming contents of the response
  @param executor executes the iteration of the stream