code: protected CliPort getCliTcpPort(String jenkinsAddr) throws IOException {
          URL jenkinsUrl = new URL(jenkinsAddr);
          if (jenkinsUrl.getHost() == null || jenkinsUrl.getHost().length() == 0) {
              throw new IOException("Invalid URL: " + jenkinsAddr);
          }
          URLConnection head = jenkinsUrl.openConnection();
          try {
              head.connect();
          } catch (IOException e) {
              throw (IOException) new IOException("Failed to connect to " + jenkinsAddr).initCause(e);
          }
  
          String h = head.getHeaderField("X-Jenkins-CLI-Host");
          if (h == null) h = head.getURL().getHost();
  
          String identity = head.getHeaderField("X-Instance-Identity");
  
          flushURLConnection(head);
  
          return new CliPort(new InetSocketAddress(h, exposedPort), identity, 2);
      }
docs: If the server advertises CLI endpoint, returns its location.