public default <T> CompletableFuture<T> promise(final Function<Traversal<S, E>, T> traversalFunction) {
        // apply strategies to see if RemoteStrategy has any effect (i.e. add RemoteStep)
        if (!this.asAdmin().isLocked()) this.asAdmin().applyStrategies();

        // use the end step so the results are bulked
        final Step<?, E> endStep = this.asAdmin().getEndStep();
        if (endStep instanceof RemoteStep) {
            return ((RemoteStep) endStep).promise().thenApply(traversalFunction);
        } else {
            throw new IllegalStateException("Only traversals created using withRemote() can be used in an async way");
        }
    }
Starts a promise to execute a function on the current {@code Traversal} that will be completed in the future.
Note that this method can only be used if the {@code Traversal} is constructed using
{@link AnonymousTraversalSource#withRemote(Configuration)}. Calling this method otherwise will yield an
{@code IllegalStateException}.
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Traversal.java