code: public static boolean isValidString(String string) {
      if ((string != null) && !string.isEmpty()) {
        String tokens[] = string.split(":");
        if ((tokens.length >= 1) && (tokens.length <= 2)) {
          if (tokens[0].matches(VALID_HOST_NAME_REGEX) || tokens[0].matches(VALID_IP_ADDR_REGEX)) {
            if (tokens.length == 1) {
              return string.length() == tokens[0].length();
            } else {
              if (!tokens[1].isEmpty()) {
                try {
                  Integer.parseInt(tokens[1]);
                  return (tokens[1].length() <= 5);
                } catch (Exception ex) {
                }
              }
            }
          }
        }
      }
      return false;
    }
docs: Tests whether a String could be deserialized into a valid ServerAddress. The string must match
  the format <code>host:port</code>, the host must be a valid hostname or IP address, and the
  port must be a valid port integer. Any string which is validated by this method should be a
  well-formed input for {@link #fromString()}.
  
  @param string to evaluate
  
  @return whether it is a valid serialized ServerAddress address.