class ByteArrayBodyHandler implements AsyncBody.Consumer<List<ByteBuffer>> {

  private final List<ByteBuffer> buffers = Collections.synchronizedList(new LinkedList<>());
  private final CompletableFuture<byte[]> result = new CompletableFuture<>();

  @Override
  public void consume(List<ByteBuffer> value, AsyncBody asyncBody) throws Exception {
    this.buffers.addAll(value);
    asyncBody.consume();
  }

  protected void onResponse(HttpResponse<AsyncBody> response) {
    AsyncBody asyncBody = response.body();
    asyncBody.done().whenComplete(this::onBodyDone);
    asyncBody.consume();
  }

  private void onBodyDone(Void v, Throwable t) {<FILL_FUNCTION_BODY>}

  public CompletableFuture<byte[]> getResult() {
    return result;
  }

}

    if (t != null) {
      result.completeExceptionally(t);
    } else {
      byte[] bytes = null;
      synchronized (buffers) {
        bytes = toArray(buffers);
      }
      result.complete(bytes);
    }
    buffers.clear();
  
<no_super_class>