private void closeAsync(CompletableFuture<?> future) {
        final CompletableFuture<?>[] closeFutures =
                endpointGroups.stream()
                              .map(AsyncCloseable::closeAsync)
                              .toArray(CompletableFuture[]::new);

        CompletableFuture.allOf(closeFutures).handle((unused, cause) -> {
            if (cause != null) {
                future.completeExceptionally(cause);
            } else {
                future.complete(null);
            }
            return null;
        });
    }
Constructs a new {@link CompositeEndpointGroup} that merges all the given {@code endpointGroups}.
core/src/main/java/com/linecorp/armeria/client/endpoint/CompositeEndpointGroup.java