The SNIHostName Class

An instance of the SNIHostName class, which extends the SNIServerName class, represents a server name of type host_name in the Server Name Indication (SNI) Extension (see The StandardConstants Class). To instantiate an SNIHostName, specify the fully qualified DNS host name of the server (as understood by the client) as a Stringargument. The argument is not valid in the following cases:
  • The argument is empty.
  • The argument ends with a trailing period.
  • The argument is not a valid Internationalized Domain Name (IDN) compliant with the RFC 3490 specification.
You can also instantiate an SNIHostName by specifying the encoded host name value as a byte array. This method is typically used to parse the encoded name value in a requested SNI extension. Otherwise, use the SNIHostName(String hostname) constructor. The encoded argument is not valid in the following cases:
  • The argument is empty.
  • The argument ends with a trailing period.
  • The argument is not a valid Internationalized Domain Name (IDN) compliant with the RFC 3490 specification.
  • The argument is not encoded in UTF-8 or US-ASCII.
Note: The encoded byte array that is passed in as an argument is cloned to protect against subsequent modification.

To return the host name of an SNIHostName object in US-ASCII encoding, use the getAsciiName() method. To compare a server name to another object, use the equals() method; the comparison is not case-sensitive. To return a hash code value of an SNIHostName, use the hashCode() method. To return a string representation of an SNIHostName, including the DNS host name, use the toString() method. You can create an SNIMatcher object for an SNIHostName object by passing a regular expression that represents one or more host names to match to the createSNIMatcher() method.