@Override
    public void apply(final Traversal.Admin<?, ?> traversal) {
        if (!(traversal.isRoot()))
            return;

        // remote step wraps the traversal and emits the results from the remote connection.
        final RemoteStep<?, ?> remoteStep = new RemoteStep<>(traversal, remoteConnection);
        TraversalHelper.removeAllSteps(traversal);
        traversal.addStep(remoteStep);

        // validations
        assert traversal.getStartStep().equals(remoteStep);
        assert traversal.getSteps().size() == 1;
        assert traversal.getEndStep() == remoteStep;
    }
Should be applied before all {@link DecorationStrategy} instances.
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/strategy/decoration/RemoteStrategy.java