code: protected Pair<String, Integer> deriveSchemeAndPortFromPartialUri(URI uri) {
          boolean isSecure = false;
          String scheme = uri.getScheme();
          if (scheme != null) {
              isSecure =  scheme.equalsIgnoreCase("https");
          }
          int port = uri.getPort();
          if (port < 0 && !isSecure){
              port = 80;
          } else if (port < 0 && isSecure){
              port = 443;
          }
          if (scheme == null){
              if (isSecure) {
                  scheme = "https";
              } else {
                  scheme = "http";
              }
          }
          return new Pair<String, Integer>(scheme, port);
      }
docs: Derive scheme and port from a partial URI. For example, for HTTP based client, the URI with
  only path "/" should return "http" and 80, whereas the URI constructed with scheme "https" and
  path "/" should return "https" and 443.
  This method is called by {@link #getServerFromLoadBalancer(java.net.URI, Object)} and
  {@link #reconstructURIWithServer(Server, java.net.URI)} methods to get the complete executable URI.