- 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
-
-
Constructor Summary
Constructors Constructor Description JsseXnioSsl(Xnio xnio, OptionMap optionMap)
Construct a new instance.JsseXnioSsl(Xnio xnio, OptionMap optionMap, javax.net.ssl.SSLContext sslContext)
Construct a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IoFuture<ConnectedSslStreamChannel>
connectSsl(XnioWorker worker, java.net.InetSocketAddress bindAddress, java.net.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, java.net.InetSocketAddress bindAddress, ChannelListener<? super AcceptingChannel<SslConnection>> acceptListener, OptionMap optionMap)
Create a bound TCP SSL server.AcceptingChannel<ConnectedSslStreamChannel>
createSslTcpServer(XnioWorker worker, java.net.InetSocketAddress bindAddress, ChannelListener<? super AcceptingChannel<ConnectedSslStreamChannel>> acceptListener, OptionMap optionMap)
Create a bound TCP SSL server.javax.net.ssl.SSLContext
getSslContext()
Get the JSSE SSL context for this provider instance.static javax.net.ssl.SSLEngine
getSslEngine(SslConnection connection)
Get the SSL engine for a given connection.IoFuture<SslConnection>
openSslConnection(XnioIoThread ioThread, java.net.InetSocketAddress bindAddress, java.net.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, java.net.InetSocketAddress bindAddress, java.net.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
-
-
-
-
Constructor Detail
-
JsseXnioSsl
public JsseXnioSsl(Xnio xnio, OptionMap optionMap) throws java.security.NoSuchProviderException, java.security.NoSuchAlgorithmException, java.security.KeyManagementException
Construct a new instance.- Parameters:
xnio
- the XNIO instance to associate withoptionMap
- the options for this provider- Throws:
java.security.NoSuchProviderException
- if the given SSL provider is not foundjava.security.NoSuchAlgorithmException
- if the given SSL algorithm is not supportedjava.security.KeyManagementException
- if the SSL context could not be initialized
-
-
Method Detail
-
getSslContext
public javax.net.ssl.SSLContext getSslContext()
Get the JSSE SSL context for this provider instance.- Returns:
- the SSL context
-
getSslEngine
public static javax.net.ssl.SSLEngine getSslEngine(SslConnection connection)
Get the SSL engine for a given connection.- Returns:
- the SSL engine
-
connectSsl
public IoFuture<ConnectedSslStreamChannel> connectSsl(XnioWorker worker, java.net.InetSocketAddress bindAddress, java.net.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 classXnioSsl
- Parameters:
worker
- the worker to usebindAddress
- the local bind addressdestination
- the destination connection addressopenListener
- the initial open-connection listenerbindListener
- the bind listeneroptionMap
- the option map- Returns:
- the SSL connection
-
openSslConnection
public IoFuture<SslConnection> openSslConnection(XnioWorker worker, java.net.InetSocketAddress bindAddress, java.net.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 classXnioSsl
- Parameters:
worker
- the worker to usebindAddress
- the local bind addressdestination
- the destination connection addressopenListener
- the initial open-connection listenerbindListener
- the bind listeneroptionMap
- the option map- Returns:
- the SSL connection
-
openSslConnection
public IoFuture<SslConnection> openSslConnection(XnioIoThread ioThread, java.net.InetSocketAddress bindAddress, java.net.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 classXnioSsl
- Parameters:
ioThread
- the IO Thread to usebindAddress
- the local bind addressdestination
- the destination connection addressopenListener
- the initial open-connection listenerbindListener
- the bind listeneroptionMap
- the option map- Returns:
- the SSL connection
-
createSslTcpServer
public AcceptingChannel<ConnectedSslStreamChannel> createSslTcpServer(XnioWorker worker, java.net.InetSocketAddress bindAddress, ChannelListener<? super AcceptingChannel<ConnectedSslStreamChannel>> acceptListener, OptionMap optionMap) throws java.io.IOException
Description copied from class:XnioSsl
Create a bound TCP SSL server.- Specified by:
createSslTcpServer
in classXnioSsl
- Parameters:
worker
- the worker to usebindAddress
- the address to bind toacceptListener
- the initial accept listeneroptionMap
- the initial configuration for the server- Returns:
- the unbound TCP SSL server
- Throws:
java.io.IOException
- if the server could not be created
-
createSslConnectionServer
public AcceptingChannel<SslConnection> createSslConnectionServer(XnioWorker worker, java.net.InetSocketAddress bindAddress, ChannelListener<? super AcceptingChannel<SslConnection>> acceptListener, OptionMap optionMap) throws java.io.IOException
Description copied from class:XnioSsl
Create a bound TCP SSL server.- Specified by:
createSslConnectionServer
in classXnioSsl
- Parameters:
worker
- the worker to usebindAddress
- the address to bind toacceptListener
- the initial accept listeneroptionMap
- the initial configuration for the server- Returns:
- the unbound TCP SSL server
- Throws:
java.io.IOException
- if the server could not be created
-
-