code: private static Endpoint selectFirstConnected(final List<Endpoint> endpoints) {
          for (Endpoint endpoint : endpoints) {
              if (endpoint.isState(LifecycleState.CONNECTED) && endpoint.isFree()) {
                  return endpoint;
              }
          }
          return null;
      }
docs: Helper method to select the first connected endpoint if no particular pinning is needed.
  
  @param endpoints the list of endpoints.
  @return the first connected or null if none found.