Top Inners Fields Constructors Methods
io.undertow.protocols.ssl

public Class UndertowXnioSsl

extends XnioSsl
Class Inheritance
Imports
java.io.IOException, java.net.InetSocketAddress, .SocketAddress, .URI, java.security.KeyManagementException, .NoSuchAlgorithmException, .NoSuchProviderException, java.util.ArrayList, .Arrays, .Collections, .HashSet, .List, .Set, java.util.concurrent.Executor, .TimeUnit, javax.net.ssl.SNIHostName, .SSLContext, .SSLEngine, .SSLParameters, io.undertow.UndertowOptions, io.undertow.connector.ByteBufferPool, io.undertow.server.DefaultByteBufferPool, org.xnio.ChannelListener, .ChannelListeners, .FutureResult, .IoFuture, .IoUtils, .Option, .OptionMap, .Options, .Sequence, .SslClientAuthMode, .StreamConnection, .Xnio, .XnioExecutor, .XnioIoThread, .XnioWorker, org.xnio.channels.AcceptingChannel, .AssembledConnectedSslStreamChannel, .BoundChannel, .ConnectedSslStreamChannel, .ConnectedStreamChannel, org.xnio.ssl.JsseSslUtils, .JsseXnioSsl, .SslConnection, .XnioSsl

Author
Stuart Douglas

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final ByteBufferPool
private static final ByteBufferPool
private final Executor
private volatile SSLContext
Inherited from org.xnio.ssl.XnioSsl:
xnio

Constructor Summary

AccessConstructor and Description
public
UndertowXnioSsl(final Xnio
the XNIO instance to associate with
xnio
,
final OptionMap
the options for this provider
optionMap
)

Construct a new instance.

public
UndertowXnioSsl(final Xnio
the XNIO instance to associate with
xnio
,
final OptionMap
the options for this provider
optionMap
,
final SSLContext
the SSL context to use for this instance
sslContext
)

Construct a new instance.

public
UndertowXnioSsl(final Xnio
the XNIO instance to associate with
xnio
,
final OptionMap
the options for this provider
optionMap
,
final SSLContext
the SSL context to use for this instance
sslContext
,
final Executor
Executor instance used to run delegated tasks.
delegatedTaskExecutor
)

Construct a new instance.

public
UndertowXnioSsl(final Xnio
the XNIO instance to associate with
xnio
,
final OptionMap
the options for this provider
optionMap
,
ByteBufferPool bufferPool)

Construct a new instance.

public
UndertowXnioSsl(final Xnio
the XNIO instance to associate with
xnio
,
final OptionMap
the options for this provider
optionMap
,
ByteBufferPool bufferPool, final SSLContext
the SSL context to use for this instance
sslContext
)

Construct a new instance.

public
UndertowXnioSsl(final Xnio
the XNIO instance to associate with
xnio
,
final OptionMap
the options for this provider
optionMap
,
ByteBufferPool bufferPool, final SSLContext
the SSL context to use for this instance
sslContext
,
final Executor
Executor instance used to run delegated tasks.
delegatedTaskExecutor
)

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public IoFuture<ConnectedSslStreamChannel>
connectSsl(final XnioWorker
the worker to use
worker
,
final InetSocketAddress
the local bind address
bindAddress
,
final InetSocketAddress
the destination connection address
destination
,
final ChannelListener<? super ConnectedSslStreamChannel>
the initial open-connection listener
openListener
,
final ChannelListener<? super BoundChannel>
the bind listener
bindListener
,
final OptionMap
the option map
optionMap
)

Implements abstract org.xnio.ssl.XnioSsl.connectSsl.

Create an SSL connection to a remote host.

public AcceptingChannel<SslConnection>
createSslConnectionServer(final XnioWorker
the worker to use
worker
,
final InetSocketAddress
the address to bind to
bindAddress
,
final ChannelListener<? super AcceptingChannel<SslConnection>>
the initial accept listener
acceptListener
,
final OptionMap
the initial configuration for the server
optionMap
)

Implements abstract org.xnio.ssl.XnioSsl.createSslConnectionServer.

Create a bound TCP SSL server.

private static SSLEngine

Returns:

the configured SSL engine
createSSLEngine
(SSLContext
the SSL context
sslContext
,
OptionMap
the SSL options
optionMap
,
InetSocketAddress
the peer address of the connection
peerAddress
,
boolean
whether this SSL connection is run in client mode
client
)

Create a new SSL engine, configured from an option map.

public AcceptingChannel<ConnectedSslStreamChannel>
createSslTcpServer(final XnioWorker
the worker to use
worker
,
final InetSocketAddress
the address to bind to
bindAddress
,
final ChannelListener<? super AcceptingChannel<ConnectedSslStreamChannel>>
the initial accept listener
acceptListener
,
final OptionMap
the initial configuration for the server
optionMap
)

Implements abstract org.xnio.ssl.XnioSsl.createSslTcpServer.

Create a bound TCP SSL server.

pack-priv Executor

Returns:

the delegated task executor or null
getDelegatedTaskExecutor
()

Get the Executor used to run delegated tasks or null if no executor is configured.

private InetSocketAddress
getPeerAddress(URI destinationURI)

public static SslConduit
public SSLContext

Returns:

the SSL context
getSslContext
()

Get the JSSE SSL context for this provider instance.

public static SSLEngine

Returns:

the SSL engine
getSslEngine
(SslConnection connection)

Get the SSL engine for a given connection.

public IoFuture<SslConnection>
openSslConnection(final XnioWorker
the worker to use
worker
,
final InetSocketAddress
the local bind address
bindAddress
,
final InetSocketAddress
the destination connection address
destination
,
final ChannelListener<? super SslConnection>
the initial open-connection listener
openListener
,
final ChannelListener<? super BoundChannel>
the bind listener
bindListener
,
final OptionMap
the option map
optionMap
)

Implements abstract org.xnio.ssl.XnioSsl.openSslConnection.

Create an SSL connection to a remote host.

public IoFuture<SslConnection>
openSslConnection(final XnioIoThread
the IO Thread to use
ioThread
,
final InetSocketAddress
the local bind address
bindAddress
,
final InetSocketAddress
the destination connection address
destination
,
final ChannelListener<? super SslConnection>
the initial open-connection listener
openListener
,
final ChannelListener<? super BoundChannel>
the bind listener
bindListener
,
final OptionMap
the option map
optionMap
)

Implements abstract org.xnio.ssl.XnioSsl.openSslConnection.

Create an SSL connection to a remote host.

private void
setSNIHostName(InetSocketAddress destination, OptionMap optionMap, SSLParameters params)

private IoFuture<SslConnection>
public void
updateSSLContext(SSLContext
The new context
context
)

Updates the SSLContext that is in use.

public SslConnection
public SslConnection
wrapExistingConnection(StreamConnection connection, OptionMap optionMap, boolean clientMode)

public SslConnection
wrapExistingConnection(StreamConnection connection, OptionMap optionMap, URI destinationURI)

Inherited from org.xnio.ssl.XnioSsl:
connectSslconnectSslconnectSslopenSslConnectionopenSslConnectionopenSslConnectionopenSslConnectionopenSslConnectionopenSslConnection

Field Detail

bufferPoolback to summary
private final ByteBufferPool bufferPool
DEFAULT_BUFFER_POOLback to summary
private static final ByteBufferPool DEFAULT_BUFFER_POOL
delegatedTaskExecutorback to summary
private final Executor delegatedTaskExecutor
sslContextback to summary
private volatile SSLContext sslContext

Hides org.xnio.ssl.XnioSsl.sslContext.

Constructor Detail

UndertowXnioSslback to summary
public UndertowXnioSsl(final Xnio xnio, final OptionMap optionMap) throws NoSuchProviderException, NoSuchAlgorithmException, KeyManagementException

Construct a new instance.

Parameters
xnio:Xnio

the XNIO instance to associate with

optionMap:OptionMap

the options for this provider

Exceptions
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
UndertowXnioSslback to summary
public UndertowXnioSsl(final Xnio xnio, final OptionMap optionMap, final SSLContext sslContext)

Construct a new instance.

Parameters
xnio:Xnio

the XNIO instance to associate with

optionMap:OptionMap

the options for this provider

sslContext:SSLContext

the SSL context to use for this instance

UndertowXnioSslback to summary
public UndertowXnioSsl(final Xnio xnio, final OptionMap optionMap, final SSLContext sslContext, final Executor delegatedTaskExecutor)

Construct a new instance.

Parameters
xnio:Xnio

the XNIO instance to associate with

optionMap:OptionMap

the options for this provider

sslContext:SSLContext

the SSL context to use for this instance

delegatedTaskExecutor:Executor

Executor instance used to run delegated tasks.

UndertowXnioSslback to summary
public UndertowXnioSsl(final Xnio xnio, final OptionMap optionMap, ByteBufferPool bufferPool) throws NoSuchProviderException, NoSuchAlgorithmException, KeyManagementException

Construct a new instance.

Parameters
xnio:Xnio

the XNIO instance to associate with

optionMap:OptionMap

the options for this provider

Exceptions
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
UndertowXnioSslback to summary
public UndertowXnioSsl(final Xnio xnio, final OptionMap optionMap, ByteBufferPool bufferPool, final SSLContext sslContext)

Construct a new instance.

Parameters
xnio:Xnio

the XNIO instance to associate with

optionMap:OptionMap

the options for this provider

sslContext:SSLContext

the SSL context to use for this instance

UndertowXnioSslback to summary
public UndertowXnioSsl(final Xnio xnio, final OptionMap optionMap, ByteBufferPool bufferPool, final SSLContext sslContext, final Executor delegatedTaskExecutor)

Construct a new instance.

Parameters
xnio:Xnio

the XNIO instance to associate with

optionMap:OptionMap

the options for this provider

sslContext:SSLContext

the SSL context to use for this instance

delegatedTaskExecutor:Executor

Executor instance used to run delegated tasks.

Method Detail

connectSslback to summary
public IoFuture<ConnectedSslStreamChannel> connectSsl(final XnioWorker worker, final InetSocketAddress bindAddress, final InetSocketAddress destination, final ChannelListener<? super ConnectedSslStreamChannel> openListener, final ChannelListener<? super BoundChannel> bindListener, final OptionMap optionMap)

Implements abstract org.xnio.ssl.XnioSsl.connectSsl.

Doc from org.xnio.ssl.XnioSsl.connectSsl.

Create an SSL connection to a remote host.

Parameters
worker:XnioWorker

the worker to use

bindAddress:InetSocketAddress

the local bind address

destination:InetSocketAddress

the destination connection address

openListener:ChannelListener<? super ConnectedSslStreamChannel>

the initial open-connection listener

bindListener:ChannelListener<? super BoundChannel>

the bind listener

optionMap:OptionMap

the option map

Returns:IoFuture<ConnectedSslStreamChannel>

the SSL connection

Annotations
@SuppressWarnings:deprecation
createSslConnectionServerback to summary
public AcceptingChannel<SslConnection> createSslConnectionServer(final XnioWorker worker, final InetSocketAddress bindAddress, final ChannelListener<? super AcceptingChannel<SslConnection>> acceptListener, final OptionMap optionMap) throws IOException

Implements abstract org.xnio.ssl.XnioSsl.createSslConnectionServer.

Doc from org.xnio.ssl.XnioSsl.createSslConnectionServer.

Create a bound TCP SSL server.

Parameters
worker:XnioWorker

the worker to use

bindAddress:InetSocketAddress

the address to bind to

acceptListener:ChannelListener<? super AcceptingChannel<SslConnection>>

the initial accept listener

optionMap:OptionMap

the initial configuration for the server

Returns:AcceptingChannel<SslConnection>

the unbound TCP SSL server

Exceptions
IOException:
if the server could not be created
createSSLEngineback to summary
private static SSLEngine createSSLEngine(SSLContext sslContext, OptionMap optionMap, InetSocketAddress peerAddress, boolean client)

Create a new SSL engine, configured from an option map.

Parameters
sslContext:SSLContext

the SSL context

optionMap:OptionMap

the SSL options

peerAddress:InetSocketAddress

the peer address of the connection

client:boolean

whether this SSL connection is run in client mode

Returns:SSLEngine

the configured SSL engine

createSslTcpServerback to summary
public AcceptingChannel<ConnectedSslStreamChannel> createSslTcpServer(final XnioWorker worker, final InetSocketAddress bindAddress, final ChannelListener<? super AcceptingChannel<ConnectedSslStreamChannel>> acceptListener, final OptionMap optionMap) throws IOException

Implements abstract org.xnio.ssl.XnioSsl.createSslTcpServer.

Doc from org.xnio.ssl.XnioSsl.createSslTcpServer.

Create a bound TCP SSL server.

Parameters
worker:XnioWorker

the worker to use

bindAddress:InetSocketAddress

the address to bind to

acceptListener:ChannelListener<? super AcceptingChannel<ConnectedSslStreamChannel>>

the initial accept listener

optionMap:OptionMap

the initial configuration for the server

Returns:AcceptingChannel<ConnectedSslStreamChannel>

the unbound TCP SSL server

Annotations
@SuppressWarnings:deprecation
Exceptions
IOException:
if the server could not be created
getDelegatedTaskExecutorback to summary
pack-priv Executor getDelegatedTaskExecutor()

Get the Executor used to run delegated tasks or null if no executor is configured.

Returns:Executor

the delegated task executor or null

getPeerAddressback to summary
private InetSocketAddress getPeerAddress(URI destinationURI)
getSslConduitback to summary
public static SslConduit getSslConduit(SslConnection connection)
getSslContextback to summary
public SSLContext getSslContext()

Get the JSSE SSL context for this provider instance.

Returns:SSLContext

the SSL context

Annotations
@SuppressWarnings:unused
getSslEngineback to summary
public static SSLEngine getSslEngine(SslConnection connection)

Get the SSL engine for a given connection.

Returns:SSLEngine

the SSL engine

openSslConnectionback to summary
public IoFuture<SslConnection> openSslConnection(final XnioWorker worker, final InetSocketAddress bindAddress, final InetSocketAddress destination, final ChannelListener<? super SslConnection> openListener, final ChannelListener<? super BoundChannel> bindListener, final OptionMap optionMap)

Implements abstract org.xnio.ssl.XnioSsl.openSslConnection.

Doc from org.xnio.ssl.XnioSsl.openSslConnection.

Create an SSL connection to a remote host.

Parameters
worker:XnioWorker

the worker to use

bindAddress:InetSocketAddress

the local bind address

destination:InetSocketAddress

the destination connection address

openListener:ChannelListener<? super SslConnection>

the initial open-connection listener

bindListener:ChannelListener<? super BoundChannel>

the bind listener

optionMap:OptionMap

the option map

Returns:IoFuture<SslConnection>

the SSL connection

openSslConnectionback to summary
public IoFuture<SslConnection> openSslConnection(final XnioIoThread ioThread, final InetSocketAddress bindAddress, final InetSocketAddress destination, final ChannelListener<? super SslConnection> openListener, final ChannelListener<? super BoundChannel> bindListener, final OptionMap optionMap)

Implements abstract org.xnio.ssl.XnioSsl.openSslConnection.

Doc from org.xnio.ssl.XnioSsl.openSslConnection.

Create an SSL connection to a remote host.

Parameters
ioThread:XnioIoThread

the IO Thread to use

bindAddress:InetSocketAddress

the local bind address

destination:InetSocketAddress

the destination connection address

openListener:ChannelListener<? super SslConnection>

the initial open-connection listener

bindListener:ChannelListener<? super BoundChannel>

the bind listener

optionMap:OptionMap

the option map

Returns:IoFuture<SslConnection>

the SSL connection

Annotations
@Override
setSNIHostNameback to summary
private void setSNIHostName(InetSocketAddress destination, OptionMap optionMap, SSLParameters params)
setupSslConnectionback to summary
private IoFuture<SslConnection> setupSslConnection(FutureResult<SslConnection> futureResult, IoFuture<StreamConnection> connection)
updateSSLContextback to summary
public void updateSSLContext(SSLContext context)

Updates the SSLContext that is in use. All new connections will use this new context, however established connections will not be affected.

Parameters
context:SSLContext

The new context

wrapExistingConnectionback to summary
public SslConnection wrapExistingConnection(StreamConnection connection, OptionMap optionMap)
wrapExistingConnectionback to summary
public SslConnection wrapExistingConnection(StreamConnection connection, OptionMap optionMap, boolean clientMode)
wrapExistingConnectionback to summary
public SslConnection wrapExistingConnection(StreamConnection connection, OptionMap optionMap, URI destinationURI)
io.undertow.protocols.ssl back to summary

private Class UndertowXnioSsl.StreamConnectionChannelListener

extends Object
implements ChannelListener<StreamConnection>
Class Inheritance
  • java.lang.Object
  • io.undertow.protocols.ssl.UndertowXnioSsl.StreamConnectionChannelListener
All Implemented Interfaces
org.xnio.ChannelListener, java.util.EventListener

Field Summary

Modifier and TypeField and Description
private final InetSocketAddress
private final FutureResult<SslConnection>
private final ChannelListener<? super SslConnection>
private final OptionMap

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
handleEvent(final StreamConnection
the channel event
connection
)

Implements org.xnio.ChannelListener.handleEvent.

Handle the event on this channel.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

destinationback to summary
private final InetSocketAddress destination
futureResultback to summary
private final FutureResult<SslConnection> futureResult
openListenerback to summary
private final ChannelListener<? super SslConnection> openListener
optionMapback to summary
private final OptionMap optionMap

Constructor Detail

StreamConnectionChannelListenerback to summary
pack-priv StreamConnectionChannelListener(OptionMap optionMap, InetSocketAddress destination, FutureResult<SslConnection> futureResult, ChannelListener<? super SslConnection> openListener)

Method Detail

handleEventback to summary
public void handleEvent(final StreamConnection connection)

Implements org.xnio.ChannelListener.handleEvent.

Doc from org.xnio.ChannelListener.handleEvent.

Handle the event on this channel.

Parameters
connection:StreamConnection

the channel event