@Override
    public int nextStep(final RouteInfo plan, final RouteInfo fact) {
        Args.notNull(plan, "Planned route");

        int step = UNREACHABLE;

        if (fact == null || fact.getHopCount() < 1) {
            step = firstStep(plan);
        } else if (plan.getHopCount() > 1) {
            step = proxiedStep(plan, fact);
        } else {
            step = directStep(plan, fact);
        }

        return step;

    }
Provides the next step.

@param plan      the planned route
@param fact      the currently established route, or
                 {@code null} if nothing is established

@return  one of the constants defined in this class, indicating
         either the next step to perform, or success, or failure.
         0 is for success, a negative value for failure.
httpclient5/src/main/java/org/apache/hc/client5/http/impl/routing/BasicRouteDirector.java