Package org.xnio.ssl

# Class SslConnection

java.lang.Object
org.xnio.Connection
org.xnio.StreamConnection
org.xnio.ssl.SslConnection

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `Channel`, `InterruptibleChannel`, `BoundChannel`, `CloseableChannel`, `CloseListenerSettable<StreamConnection>`, `Configurable`, `ConnectedChannel`, `SslChannel`

Direct Known Subclasses:
  `JsseSslConnection`, `JsseSslStreamConnection`

public abstract class SslConnection extends StreamConnection implements SslChannel
A stream connection which can use SSL/TLS to negotiate a security layer.

Author:
  Flavia Rainone

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.xnio.channels.CloseListenerSettable

`CloseListenerSettable.Setter<C extends Channel>`

## Field Summary

### Fields inherited from class org.xnio.Connection

`thread`

### Fields inherited from interface org.xnio.channels.Configurable

`EMPTY`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`SslConnection(XnioIoThread thread)`
Construct a new instance.

## Method Summary

Modifier and Type
Method
Description
`ChannelListener.Setter<? extends SslConnection>`
`getCloseSetter()`
Get the setter which can be used to change the close listener for this channel.
`abstract ChannelListener.Setter<? extends SslConnection>`
`getHandshakeSetter()`
Get the setter which can be used to change the handshake listener for this channel.
`abstract SSLSession`
`getSslSession()`
Get the current `SSLSession` for this channel.
`abstract void`
`startHandshake()`
Start or restart the SSL/TLS handshake.

### Methods inherited from class org.xnio.StreamConnection

`getCloseListener, getSinkChannel, getSourceChannel, notifyReadClosed, notifyWriteClosed, setCloseListener, setSinkConduit, setSourceConduit`

### Methods inherited from class org.xnio.Connection

`close, closeAction, getIoThread, getLocalAddress, getOption, getPeerAddress, getWorker, isOpen, isReadShutdown, isWriteShutdown, readClosed, setOption, supportsOption, writeClosed`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.xnio.channels.BoundChannel

`getLocalAddress, getLocalAddress`

### Methods inherited from interface java.nio.channels.Channel

`isOpen`

### Methods inherited from interface org.xnio.channels.CloseableChannel

`close, getIoThread, getWorker`

### Methods inherited from interface org.xnio.channels.Configurable

`getOption, setOption, supportsOption`

### Methods inherited from interface org.xnio.channels.ConnectedChannel

`getPeerAddress, getPeerAddress`

## Constructor Details

### SslConnection

protected SslConnection(XnioIoThread thread)
Construct a new instance.

Parameters:
  `thread` - the I/O thread of this connection

## Method Details

### startHandshake

public abstract void startHandshake() throws IOException
Start or restart the SSL/TLS handshake. To force a complete SSL/TLS session renegotiation, the current session should be invalidated prior to calling this method. This method is not needed for the initial handshake unless the `Options.SSL_STARTTLS` option is set as sending or receiving over the channel will automatically initiate it. This method must not be called while a read or write operation is taking place.

Specified by:
  `startHandshake` in interface `SslChannel`
Throws:
  `IOException` - if an I/O error occurs

### getSslSession

public abstract SSLSession getSslSession()
Get the current `SSLSession` for this channel.

Specified by:
  `getSslSession` in interface `SslChannel`
Returns:
  the current `SSLSession`

### getHandshakeSetter

public abstract ChannelListener.Setter<? extends SslConnection> getHandshakeSetter()
Get the setter which can be used to change the handshake listener for this channel.

Specified by:
  `getHandshakeSetter` in interface `SslChannel`
Returns:
  the setter

### getCloseSetter

public ChannelListener.Setter<? extends SslConnection> getCloseSetter()
Get the setter which can be used to change the close listener for this channel. If the channel is already closed, then the listener will not be called.

Specified by:
  `getCloseSetter` in interface `BoundChannel`
Specified by:
  `getCloseSetter` in interface `CloseableChannel`
Specified by:
  `getCloseSetter` in interface `ConnectedChannel`
Specified by:
  `getCloseSetter` in interface `SslChannel`
Overrides:
  `getCloseSetter` in class `StreamConnection`
Returns:
  the setter