APIdia Launch Partner
Top Description Fields Constructors Methods
javax.net.ssl

public abstract Class SNIServerName

extends Object
Class Inheritance
Known Direct Subclasses
sun.security.ssl.ServerNameExtension.CHServerNamesSpec.UnknownServerName, javax.net.ssl.SNIHostName
Imports
java.util.Arrays, .HexFormat, .List

Instances of this class represent a server name in a Server Name Indication (SNI) extension.

The SNI extension is a feature that extends the SSL/TLS/DTLS protocols to indicate what server name the client is attempting to connect to during handshaking. See section 3, "Server Name Indication", of TLS Extensions (RFC 6066).

SNIServerName objects are immutable. Subclasses should not provide methods that can change the state of an instance once it has been created.

Since
1.8
External Specification
https://www.rfc-editor.org/info/rfc6066
See Also
SSLParameters#getServerNames(), SSLParameters#setServerNames(List)

Field Summary

Modifier and TypeField and Description
private final byte[]
private final int

Constructor Summary

AccessConstructor and Description
protected
SNIServerName(int
the type of the server name
type
,
byte[]
the encoded value of the server name
encoded
)

Creates an SNIServerName using the specified name type and encoded value.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if, and only if, other is of the same class of this object, and has the same name type and encoded value as this server name.
equals
(Object other)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this server name.

public final byte[]

Returns:

a copy of the encoded server name value of this server name
getEncoded
()

Returns a copy of the encoded server name value of this server name.

public final int

Returns:

the name type of this server name
getType
()

Returns the name type of this server name.

public int

Returns:

a hash code value for this server name.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this server name.

private static String
toHexString(byte[] bytes)

public String

Returns:

a string representation of this server name
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of this server name, including the server name type and the encoded server name value in this SNIServerName object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

encodedback to summary
private final byte[] encoded
typeback to summary
private final int type

Constructor Detail

SNIServerNameback to summary
protected SNIServerName(int type, byte[] encoded)

Creates an SNIServerName using the specified name type and encoded value.

Note that the encoded byte array is cloned to protect against subsequent modification.

Parameters
type:int

the type of the server name

encoded:byte[]

the encoded value of the server name

Exceptions
IllegalArgumentException:
if type is not in the range of 0 to 255, inclusive.
NullPointerException:
if encoded is null

Method Detail

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this server name.

Returns:boolean

true if, and only if, other is of the same class of this object, and has the same name type and encoded value as this server name.

Annotations
@Override
getEncodedback to summary
public final byte[] getEncoded()

Returns a copy of the encoded server name value of this server name.

Returns:byte[]

a copy of the encoded server name value of this server name

getTypeback to summary
public final int getType()

Returns the name type of this server name.

Returns:int

the name type of this server name

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this server name.

The hash code value is generated using the name type and encoded value of this server name.

Returns:int

a hash code value for this server name.

Annotations
@Override
toHexStringback to summary
private static String toHexString(byte[] bytes)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string representation of this server name, including the server name type and the encoded server name value in this SNIServerName object.

The exact details of the representation are unspecified and subject to change, but the following may be regarded as typical:

    "type=<name type>, value=<name value>"

In this class, the format of "<name type>" is "[LITERAL] (INTEGER)", where the optional "LITERAL" is the literal name, and INTEGER is the integer value of the name type. The format of "<name value>" is "XX:...:XX", where "XX" is the hexadecimal digit representation of a byte value. For example, a returned value of a pseudo server name may look like:

    "type=(31), value=77:77:77:2E:65:78:61:6D:70:6C:65:2E:63:6E"
or
    "type=host_name (0), value=77:77:77:2E:65:78:61:6D:70:6C:65:2E:63:6E"

Please NOTE that the exact details of the representation are unspecified and subject to change, and subclasses may override the method with their own formats.

Returns:String

a string representation of this server name

Annotations
@Override