@Nonnull
    static <U> Promise<U> wrapFuture(@Nonnull Future<U> future) {
        if (future instanceof CompletableFuture<?>) {
            return new HelperPromise<>(((CompletableFuture<U>) future).thenApply(Function.identity()));

        } else if (future instanceof CompletionStage<?>) {
            //noinspection unchecked
            CompletionStage<U> fut = (CompletionStage<U>) future;
            return new HelperPromise<>(fut.toCompletableFuture().thenApply(Function.identity()));

        } else if (future instanceof ListenableFuture<?>) {
            ListenableFuture<U> fut = (ListenableFuture<U>) future;
            HelperPromise<U> promise = empty();
            promise.supplied.set(true);

            Futures.addCallback(fut, new FutureCallback<U>() {
                @Override
                public void onSuccess(@Nullable U result) {
                    promise.complete(result);
                }

                @Override
                public void onFailure(@Nonnull Throwable t) {
                    promise.completeExceptionally(t);
                }
            });

            return promise;

        } else {
            if (future.isDone()) {
                try {
                    return completed(future.get());
                } catch (ExecutionException e) {
                    return exceptionally(e);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            } else {
                return Promise.supplyingExceptionallyAsync(future::get);
            }
        }
    }
Implementation of {@link Promise} using the server scheduler.

@param <V> the result type
helper/src/main/java/me/lucko/helper/promise/HelperPromise.java