Package org.xnio.ssl

# Class JsseXnioSsl

java.lang.Object
org.xnio.ssl.XnioSsl
org.xnio.ssl.JsseXnioSsl

public final class JsseXnioSsl extends XnioSsl
An XNIO SSL provider based on JSSE. Works with any XNIO provider.

Author:
  David M. Lloyd, Flavia Rainone

## Field Summary

Fields
Modifier and Type
Field
Description
`static final boolean`
`NEW_IMPL`

### Fields inherited from class org.xnio.ssl.XnioSsl

`xnio`

## Constructor Summary

Constructors
Constructor
Description
`JsseXnioSsl(Xnio xnio, OptionMap optionMap)`
Construct a new instance.
`JsseXnioSsl(Xnio xnio, OptionMap optionMap, SSLContext sslContext)`
Construct a new instance.

## Method Summary

Modifier and Type
Method
Description
`IoFuture<ConnectedSslStreamChannel>`
`connectSsl(XnioWorker worker, InetSocketAddress bindAddress, InetSocketAddress destination, ChannelListener<? super ConnectedSslStreamChannel> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap)`
Create an SSL connection to a remote host.
`AcceptingChannel<SslConnection>`
`createSslConnectionServer(XnioWorker worker, InetSocketAddress bindAddress, ChannelListener<? super AcceptingChannel<SslConnection>> acceptListener, OptionMap optionMap)`
Create a bound TCP SSL server.
`AcceptingChannel<ConnectedSslStreamChannel>`
`createSslTcpServer(XnioWorker worker, InetSocketAddress bindAddress, ChannelListener<? super AcceptingChannel<ConnectedSslStreamChannel>> acceptListener, OptionMap optionMap)`
Create a bound TCP SSL server.
`SSLContext`
`getSslContext()`
Get the JSSE SSL context for this provider instance.
`static SSLEngine`
`getSslEngine(SslConnection connection)`
Get the SSL engine for a given connection.
`IoFuture<SslConnection>`
`openSslConnection(XnioIoThread ioThread, InetSocketAddress bindAddress, InetSocketAddress destination, ChannelListener<? super SslConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap)`
Create an SSL connection to a remote host.
`IoFuture<SslConnection>`
`openSslConnection(XnioWorker worker, InetSocketAddress bindAddress, InetSocketAddress destination, ChannelListener<? super SslConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap)`
Create an SSL connection to a remote host.

### Methods inherited from class org.xnio.ssl.XnioSsl

`connectSsl, connectSsl, connectSsl, openSslConnection, openSslConnection, openSslConnection, openSslConnection, openSslConnection, openSslConnection`

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

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

## Field Details

### NEW_IMPL

public static final boolean NEW_IMPL

## Constructor Details

### JsseXnioSsl

public JsseXnioSsl(Xnio xnio, OptionMap optionMap) throws NoSuchProviderException, NoSuchAlgorithmException, KeyManagementException
Construct a new instance.

Parameters:
  `xnio` - the XNIO instance to associate with
  `optionMap` - the options for this provider
Throws:
  `NoSuchProviderException` - if the given SSL provider is not found
  `NoSuchAlgorithmException` - if the given SSL algorithm is not supported
  `KeyManagementException` - if the SSL context could not be initialized

### JsseXnioSsl

public JsseXnioSsl(Xnio xnio, OptionMap optionMap, SSLContext sslContext)
Construct a new instance.

Parameters:
  `xnio` - the XNIO instance to associate with
  `optionMap` - the options for this provider
  `sslContext` - the SSL context to use for this instance

## Method Details

### getSslContext

public SSLContext getSslContext()
Get the JSSE SSL context for this provider instance.

Returns:
  the SSL context

### getSslEngine

public static SSLEngine getSslEngine(SslConnection connection)
Get the SSL engine for a given connection.

Returns:
  the SSL engine

### connectSsl

public IoFuture<ConnectedSslStreamChannel> connectSsl(XnioWorker worker, InetSocketAddress bindAddress, InetSocketAddress destination, ChannelListener<? super ConnectedSslStreamChannel> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap)
Description copied from class: `XnioSsl`
Create an SSL connection to a remote host.

Specified by:
  `connectSsl` in class `XnioSsl`
Parameters:
  `worker` - the worker to use
  `bindAddress` - the local bind address
  `destination` - the destination connection address
  `openListener` - the initial open-connection listener
  `bindListener` - the bind listener
  `optionMap` - the option map
Returns:
  the SSL connection

### openSslConnection

public IoFuture<SslConnection> openSslConnection(XnioWorker worker, InetSocketAddress bindAddress, InetSocketAddress destination, ChannelListener<? super SslConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap)
Description copied from class: `XnioSsl`
Create an SSL connection to a remote host.

Specified by:
  `openSslConnection` in class `XnioSsl`
Parameters:
  `worker` - the worker to use
  `bindAddress` - the local bind address
  `destination` - the destination connection address
  `openListener` - the initial open-connection listener
  `bindListener` - the bind listener
  `optionMap` - the option map
Returns:
  the SSL connection

### openSslConnection

public IoFuture<SslConnection> openSslConnection(XnioIoThread ioThread, InetSocketAddress bindAddress, InetSocketAddress destination, ChannelListener<? super SslConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap)
Description copied from class: `XnioSsl`
Create an SSL connection to a remote host.

Specified by:
  `openSslConnection` in class `XnioSsl`
Parameters:
  `ioThread` - the IO Thread to use
  `bindAddress` - the local bind address
  `destination` - the destination connection address
  `openListener` - the initial open-connection listener
  `bindListener` - the bind listener
  `optionMap` - the option map
Returns:
  the SSL connection

### createSslTcpServer

public AcceptingChannel<ConnectedSslStreamChannel> createSslTcpServer(XnioWorker worker, InetSocketAddress bindAddress, ChannelListener<? super AcceptingChannel<ConnectedSslStreamChannel>> acceptListener, OptionMap optionMap) throws IOException
Description copied from class: `XnioSsl`
Create a bound TCP SSL server.

Specified by:
  `createSslTcpServer` in class `XnioSsl`
Parameters:
  `worker` - the worker to use
  `bindAddress` - the address to bind to
  `acceptListener` - the initial accept listener
  `optionMap` - the initial configuration for the server
Returns:
  the unbound TCP SSL server
Throws:
  `IOException` - if the server could not be created

### createSslConnectionServer

public AcceptingChannel<SslConnection> createSslConnectionServer(XnioWorker worker, InetSocketAddress bindAddress, ChannelListener<? super AcceptingChannel<SslConnection>> acceptListener, OptionMap optionMap) throws IOException
Description copied from class: `XnioSsl`
Create a bound TCP SSL server.

Specified by:
  `createSslConnectionServer` in class `XnioSsl`
Parameters:
  `worker` - the worker to use
  `bindAddress` - the address to bind to
  `acceptListener` - the initial accept listener
  `optionMap` - the initial configuration for the server
Returns:
  the unbound TCP SSL server
Throws:
  `IOException` - if the server could not be created