Returns a
List
containing all
SNIServerName
s of the Server Name Indication (SNI) parameter, or null if none has been set.
This method is only useful to SSLSocket
s or SSLEngine
s operating in client mode.
For SSL/TLS/DTLS connections, the underlying SSL/TLS/DTLS provider may specify a default value for a certain server name type. In client mode, it is recommended that, by default, providers should include the server name indication whenever the server can be located by a supported server name type.
It is recommended that providers initialize default Server Name Indications when creating SSLSocket
/SSLEngine
s. In the following examples, the server name could be represented by an instance of SNIHostName
which has been initialized with the hostname "www.example.com" and type StandardConstants.SNI_HOST_NAME
.
Socket socket =
sslSocketFactory.createSocket("www.example.com", 443);
or
SSLEngine engine =
sslContext.createSSLEngine("www.example.com", 443);