# SNIServerName

public abstract class **SNIServerName** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  

|---|---|---|
| Known Direct Subclasses [SNIHostName](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIHostName.html) |---|---| | [SNIHostName](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIHostName.html) | Instances of this class represent a server name of type `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/StandardConstants.html#SNI_HOST_NAME` in a Server Name Indication (SNI) extension. | |||

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 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)](http://www.ietf.org/rfc/rfc6066.txt).


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

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLParameters.html#getServerNames()`
- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLParameters.html#setServerNames(java.util.List<javax.net.ssl.SNIServerName>)`

### Protected Constructor Summary

|---|---|
|   | [SNIServerName](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIServerName.html#SNIServerName(int,%20byte[]))(int type, byte\[\] encoded) Creates an `SNIServerName` using the specified name type and encoded value. |

### Public Method Summary

|---|---|
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIServerName.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) other) Indicates whether some other object is "equal to" this server name. |
| final byte\[\] | [getEncoded](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIServerName.html#getEncoded())() Returns a copy of the encoded server name value of this server name. |
| final int | [getType](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIServerName.html#getType())() Returns the name type of this server name. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIServerName.html#hashCode())() Returns a hash code value for this server name. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIServerName.html#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 Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Protected Constructors

#### 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 | the type of the server name |
| encoded | the encoded value of the server name |
|---|---|

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if `type` is not in the range of 0 to 255, inclusive. |
| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if `encoded` is null |
|---|---|

## Public Methods

#### public boolean
**equals**
([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) other)

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

##### Parameters

| other | the object to compare this instance with. |
|---|---|

##### 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.

#### public final byte\[\]
**getEncoded**
()

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

##### Returns

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

#### public final int
**getType**
()

Returns the name type of this server name.

##### Returns

- the name type of this server name

#### public int
**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

- a hash code value for this server name.

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**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 an 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

- a string representation of this server name