# SNIMatcher

public abstract class **SNIMatcher** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
Instances of this class represent a matcher that performs match
operations on an `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIServerName.html` instance.


Servers can use Server Name Indication (SNI) information to decide if
specific `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLSocket.html` or `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLEngine.html` instances should accept
a connection. For example, when multiple "virtual" or "name-based"
servers are hosted on a single underlying network address, the server
application can use SNI information to determine whether this server is
the exact server that the client wants to access. Instances of this
class can be used by a server to verify the acceptable server names of
a particular type, such as host names.


`SNIMatcher` 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/SNIServerName.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIHostName.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLParameters.html#getSNIMatchers()`
- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLParameters.html#setSNIMatchers(java.util.Collection<javax.net.ssl.SNIMatcher>)`

### Protected Constructor Summary

|---|---|
|   | [SNIMatcher](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIMatcher.html#SNIMatcher(int))(int type) Creates an `SNIMatcher` using the specified server name type. |

### Public Method Summary

|---|---|
| final int | [getType](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIMatcher.html#getType())() Returns the server name type of this `SNIMatcher` object. |
| abstract boolean | [matches](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIMatcher.html#matches(javax.net.ssl.SNIServerName))([SNIServerName](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIServerName.html) serverName) Attempts to match the given `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIServerName.html`. |

### 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
**SNIMatcher**
(int type)

Creates an `SNIMatcher` using the specified server name type.

##### Parameters

| type | the type of the server name that this matcher performs on |
|---|---|

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

## Public Methods

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

Returns the server name type of this `SNIMatcher` object.

##### Returns

- the server name type of this `SNIMatcher` object.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIServerName.html`

#### public abstract boolean
**matches**
([SNIServerName](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIServerName.html) serverName)

Attempts to match the given `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIServerName.html`.

##### Parameters

| serverName | the `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIServerName.html` instance on which this matcher performs match operations |
|---|---|

##### Returns

- `true` if, and only if, the matcher matches the given `serverName`

##### Throws

| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if `serverName` is `null` |
| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if `serverName` is not of the given server name type of this matcher |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SNIServerName.html`