code: public void subscribe(URI mesosMasterURI, SingularityMesosScheduler scheduler) throws URISyntaxException {
  
      FrameworkInfo frameworkInfo = buildFrameworkInfo();
  
      if (mesosMasterURI == null || mesosMasterURI.getScheme().contains("zk")) {
        throw new IllegalArgumentException(String.format("Must use master address for http api (e.g. http://localhost:5050/api/v1/scheduler) was %s", mesosMasterURI));
      }
  
      if (openStream == null || openStream.isUnsubscribed()) {
  
        // Do we get here ever?
        if (subscriberThread != null) {
          subscriberThread.interrupt();
        }
  
        subscriberThread = new Thread() {
          public void run() {
            try {
              connect(mesosMasterURI, frameworkInfo, scheduler);
            } catch (RuntimeException|URISyntaxException e) {
              LOG.error("Could not connect: ", e);
              scheduler.onConnectException(e);
            }
          }
  
        };
        subscriberThread.start();
      }
    }
docs: The first call to mesos, needed to setup connection properly and identify
  a framework.
  
  @throws URISyntaxException if the URL provided was not a syntactically correct URL.