code: private Optional<String[]> parseCredentials(String url) {
          if (!Strings.isNullOrEmpty(url)) {
              int p;
              if ((p = url.indexOf("://")) != -1) {
                  url = url.substring(p + 3);
              }
              if ((p = url.indexOf('@')) != -1) {
                  String[] result = new String[2];
                  String credentials = url.substring(0, p);
                  if ((p = credentials.indexOf(':')) != -1) {
                      result[0] = credentials.substring(0, p);
                      result[1] = credentials.substring(p + 1);
                  } else {
                      result[0] = credentials;
                      result[1] = "";
                  }
                  return Optional.of(result);
              }
          }
          return Optional.empty();
      }
docs: Given a proxy URL returns a two element arrays containing the user name and the password. The second component
  of the array is null if no password is specified.
  
  @param url The proxy host URL.
  @return An optional containing an array of the user name and the password or empty when none are present or
  the url is empty.