code: @Override
      public Endpoint select(CouchbaseRequest request, List<Endpoint> endpoints) {
          int endpointSize = endpoints.size();
          //increments skip and prevents it to overflow to a negative value
          skip = Math.max(0, skip+1);
          int offset = skip % endpointSize;
  
          //attempt to find a CONNECTED endpoint at the offset, or try following ones
          for (int i = offset; i < endpointSize; i++) {
              Endpoint endpoint = endpoints.get(i);
              if (endpoint.isState(LifecycleState.CONNECTED) && endpoint.isFree()) {
                  return endpoint;
              }
          }
  
          //arriving here means the offset endpoint wasn't CONNECTED and none of the endpoints after it were.
          //wrap around and try from the beginning of the array
          for (int i = 0; i < offset; i++) {
              Endpoint endpoint = endpoints.get(i);
              if (endpoint.isState(LifecycleState.CONNECTED) && endpoint.isFree()) {
                  return endpoint;
              }
          }
  
          //lastly, really no eligible endpoint was found, return null
          return null;
      }
docs: Selects an {@link Endpoint} for the given {@link CouchbaseRequest}.
  <p></p>
  If null is returned, it means that no endpoint could be selected and it is up to the calling party
  to decide what to do next.
  
  @param request   the input request.
  @param endpoints all the available endpoints.
  @return the selected endpoint.