static EthStatsConnectOptions fromParams(
      final String url, final String contact, final Path caCert) {
    try {
      checkArgument(url != null && !url.trim().isEmpty(), "Invalid empty value.");

      // if scheme is not specified in the URI, user info (nodename) gets converted to scheme.
      final URI uri;
      final String scheme;
      if (url.matches("^.*://.*$")) {
        // construct URI
        uri = URI.create(url);
        scheme = uri.getScheme();
      } else {
        // prepend ws:// to make a valid URI while keeping scheme as null
        uri = URI.create("ws://" + url);
        scheme = null;
      }

      if (scheme != null) {
        // make sure that scheme is either ws or wss
        if (!scheme.equalsIgnoreCase("ws") && !scheme.equalsIgnoreCase("wss")) {
          throw new IllegalArgumentException("Ethstats URI only support ws:// or wss:// scheme.");
        }
      }

      final String userInfo = uri.getUserInfo();

      // make sure user info is specified
      if (userInfo == null || !userInfo.contains(":")) {
        throw new IllegalArgumentException("Ethstats URI missing user info.");
      }
      final String nodeName = userInfo.substring(0, userInfo.indexOf(":"));
      final String secret = userInfo.substring(userInfo.indexOf(":") + 1);

      return ImmutableEthStatsConnectOptions.builder()
          .scheme(scheme)
          .nodeName(nodeName)
          .secret(secret)
          .host(uri.getHost())
          .port(uri.getPort())
          .contact(contact)
          .caCert(caCert)
          .build();
    } catch (IllegalArgumentException e) {
      LoggerFactory.getLogger(EthStatsConnectOptions.class).error(e.getMessage());
    }
    throw new IllegalArgumentException(
        "Invalid ethstats URL syntax. Ethstats URL should have the following format '[ws://|wss://]nodename:secret@host[:port]'.");
  }
Creates an EthStatsConnectOptions from the given parameters.

@param url the url of the connection
@param contact the contact of the connection
@param caCert the CA certificate of the connection
@return the EthStatsConnectOptions
ethereum/ethstats/src/main/java/org/hyperledger/besu/ethstats/util/EthStatsConnectOptions.java