private boolean isValidServerBasedAuthority(String host,int port,String userinfo){
  if (!isWellFormedAddress(host)) {
    return false;
  }
  if (port < -1 || port > 65535) {
    return false;
  }
  if (userinfo != null) {
    int index=0;
    int end=userinfo.length();
    char testChar='\0';
    while (index < end) {
      testChar=userinfo.charAt(index);
      if (testChar == '%') {
        if (index + 2 >= end || !isHex(userinfo.charAt(index + 1)) || !isHex(userinfo.charAt(index + 2))) {
          return false;
        }
        index+=2;
      }
 else       if (!isUserinfoCharacter(testChar)) {
        return false;
      }
      ++index;
    }
  }
  return true;
}

private boolean isValidServerBasedAuthority ( String host , int port , String userinfo ) { if ( ! isWellFormedAddress ( host ) ) { return false ; } if ( port < - 1 || port > 65535 ) { return false ; } if ( userinfo != null ) { int index = 0 ; int end = userinfo . length ( ) ; char testChar = '\0' ; while ( index < end ) { testChar = userinfo . charAt ( index ) ; if ( testChar == '%' ) { if ( index + 2 >= end || ! isHex ( userinfo . charAt ( index + 1 ) ) || ! isHex ( userinfo . charAt ( index + 2 ) ) ) { return false ; } index += 2 ; } else if ( ! isUserinfoCharacter ( testChar ) ) { return false ; } ++ index ; } } return true ; }
determines whether the components host , port , and user info are valid as a server authority .
