Top Description Fields Constructors Methods
org.xnio.ssl

public final Class JsseSslStreamConnection

extends SslConnection
Class Inheritance
Imports
java.io.IOException, java.net.SocketAddress, java.nio.ByteBuffer, java.util.Set, java.util.concurrent.atomic.AtomicIntegerFieldUpdater, javax.net.ssl.SSLEngine, .SSLSession, org.xnio.ChannelListener, .ChannelListeners, .Connection, .Option, .Options, .Pool, .SslClientAuthMode, .StreamConnection, org.xnio.conduits.StreamSinkConduit, .StreamSourceConduit

StreamConnection with SSL support.
Author
Flavia Rainone

Field Summary

Modifier and TypeField and Description
private final StreamConnection
connection

Delegate connection.

private static final int
private static final int
private static final int
private static final int
private final ChannelListener.SimpleSetter<SslConnection>
handshakeSetter

Callback for notification of a handshake being finished.

private final JsseSslConduitEngine
sslConduitEngine

The conduit SSl engine.

private volatile int
private static final AtomicIntegerFieldUpdater<JsseSslStreamConnection>
private static final Set<Option<?>>
private volatile boolean
tls

Indicates if tls is enabled.

Constructor Summary

AccessConstructor and Description
public
JsseSslStreamConnection(StreamConnection connection, SSLEngine sslEngine, final boolean startTls)

pack-priv
JsseSslStreamConnection(StreamConnection connection, SSLEngine sslEngine, final Pool<ByteBuffer> socketBufferPool, final Pool<ByteBuffer> applicationBufferPool, final boolean startTls)
References Deprecated Pool is deprecated or references (maybe indirectly) at least one deprecated element.

Method Summary

Modifier and TypeMethod and Description
protected void
closeAction()

Overrides org.xnio.Connection.closeAction.

The close action to perform on this connection.

pack-priv SSLEngine
public ChannelListener.Setter<? extends SslConnection>
getHandshakeSetter()

Implements abstract org.xnio.ssl.SslConnection.getHandshakeSetter.

Implements org.xnio.channels.SslChannel.getHandshakeSetter.

Get the setter which can be used to change the handshake listener for this channel.

public SocketAddress
getLocalAddress()

Implements org.xnio.channels.BoundChannel.getLocalAddress.

Get the local address that this channel is bound to.

public <T> T
getOption(final Option<T>
the option to get
option
)

Overrides org.xnio.Connection.getOption.

Implements org.xnio.channels.Configurable.getOption.

Get the value of a channel option.

public SocketAddress
getPeerAddress()

Implements org.xnio.channels.ConnectedChannel.getPeerAddress.

Get the peer address of this channel.

public SSLSession
getSslSession()

Implements abstract org.xnio.ssl.SslConnection.getSslSession.

Implements org.xnio.channels.SslChannel.getSslSession.

Get the current SSLSession for this channel.

protected void
handleHandshakeFinished()

Callback method for notification of handshake finished.

public boolean
isReadShutdown()

Overrides org.xnio.Connection.isReadShutdown.

Determine whether reads have been shut down on this connection.

public boolean

Returns:

true if writes were shut down
isWriteShutdown
()

Overrides org.xnio.Connection.isWriteShutdown.

Determine whether writes have been shut down on this connection.

protected void
notifyReadClosed()

Overrides org.xnio.StreamConnection.notifyReadClosed.

Indicate to conduit handlers that reads have been closed.

protected void
notifyWriteClosed()

Overrides org.xnio.StreamConnection.notifyWriteClosed.

Indicate to conduit handlers that writes have been closed.

protected boolean
readClosed()

Overrides org.xnio.Connection.readClosed.

Indicate that reads have been closed on this connection.

public <T> T
setOption(final Option<T>
the option to set
option
,
final T
the value of the option to set
value
)

Overrides org.xnio.Connection.setOption.

Implements org.xnio.channels.Configurable.setOption.

Set an option for this channel.

public synchronized void
startHandshake()

Implements abstract org.xnio.ssl.SslConnection.startHandshake.

Implements org.xnio.channels.SslChannel.startHandshake.

Start or restart the SSL/TLS handshake.

public boolean
supportsOption(final Option<?>
the option
option
)

Overrides org.xnio.Connection.supportsOption.

Implements org.xnio.channels.Configurable.supportsOption.

Determine whether an option is supported on this channel.

protected boolean
writeClosed()

Overrides org.xnio.Connection.writeClosed.

Indicate that writes have been closed on this connection.

Inherited from org.xnio.ssl.SslConnection:
getCloseSetter

Field Detail

connectionback to summary
private final StreamConnection connection

Delegate connection.

FLAG_READ_CLOSE_REQUESTEDback to summary
private static final int FLAG_READ_CLOSE_REQUESTED
FLAG_READ_CLOSEDback to summary
private static final int FLAG_READ_CLOSED

Hides org.xnio.Connection.FLAG_READ_CLOSED.

FLAG_WRITE_CLOSE_REQUESTEDback to summary
private static final int FLAG_WRITE_CLOSE_REQUESTED
FLAG_WRITE_CLOSEDback to summary
private static final int FLAG_WRITE_CLOSED

Hides org.xnio.Connection.FLAG_WRITE_CLOSED.

handshakeSetterback to summary
private final ChannelListener.SimpleSetter<SslConnection> handshakeSetter

Callback for notification of a handshake being finished.

sslConduitEngineback to summary
private final JsseSslConduitEngine sslConduitEngine

The conduit SSl engine.

stateback to summary
private volatile int state

Hides org.xnio.Connection.state.

Annotations
@SuppressWarnings:unused
stateUpdaterback to summary
private static final AtomicIntegerFieldUpdater<JsseSslStreamConnection> stateUpdater

Hides org.xnio.Connection.stateUpdater.

SUPPORTED_OPTIONSback to summary
private static final Set<Option<?>> SUPPORTED_OPTIONS
tlsback to summary
private volatile boolean tls

Indicates if tls is enabled.

Constructor Detail

JsseSslStreamConnectionback to summary
public JsseSslStreamConnection(StreamConnection connection, SSLEngine sslEngine, final boolean startTls)
JsseSslStreamConnectionback to summary
pack-priv JsseSslStreamConnection(StreamConnection connection, SSLEngine sslEngine, final Pool<ByteBuffer> socketBufferPool, final Pool<ByteBuffer> applicationBufferPool, final boolean startTls)

References Deprecated

Pool is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Method Detail

closeActionback to summary
protected void closeAction() throws IOException

Overrides org.xnio.Connection.closeAction.

Doc from org.xnio.Connection.closeAction.

The close action to perform on this connection.

Annotations
@Override
Exceptions
IOException:
if close fails
getEngineback to summary
pack-priv SSLEngine getEngine()
getHandshakeSetterback to summary
public ChannelListener.Setter<? extends SslConnection> getHandshakeSetter()

Implements abstract org.xnio.ssl.SslConnection.getHandshakeSetter.

Implements org.xnio.channels.SslChannel.getHandshakeSetter.

Doc from org.xnio.ssl.SslConnection.getHandshakeSetter.

Get the setter which can be used to change the handshake listener for this channel.

Returns:ChannelListener.Setter<? extends SslConnection>

the setter

Annotations
@Override
getLocalAddressback to summary
public SocketAddress getLocalAddress()

Implements org.xnio.channels.BoundChannel.getLocalAddress.

Doc from org.xnio.channels.BoundChannel.getLocalAddress.

Get the local address that this channel is bound to.

Returns:SocketAddress

the local address

Annotations
@Override
getOptionback to summary
public <T> T getOption(final Option<T> option) throws IOException

Overrides org.xnio.Connection.getOption.

Implements org.xnio.channels.Configurable.getOption.

Doc from org.xnio.channels.Configurable.getOption.

Get the value of a channel option.

Parameters
<T>
the type of the option value
option:Option<T>

the option to get

Returns:T

the value of the option, or null if it is not set

Annotations
@Override
Exceptions
IOException:
if an I/O error occurred when reading the option
getPeerAddressback to summary
public SocketAddress getPeerAddress()

Implements org.xnio.channels.ConnectedChannel.getPeerAddress.

Doc from org.xnio.channels.ConnectedChannel.getPeerAddress.

Get the peer address of this channel.

Returns:SocketAddress

the peer address

Annotations
@Override
getSslSessionback to summary
public SSLSession getSslSession()

Implements abstract org.xnio.ssl.SslConnection.getSslSession.

Implements org.xnio.channels.SslChannel.getSslSession.

Doc from org.xnio.ssl.SslConnection.getSslSession.

Get the current SSLSession for this channel.

Returns:SSLSession

the current SSLSession

Annotations
@Override
handleHandshakeFinishedback to summary
protected void handleHandshakeFinished()

Callback method for notification of handshake finished.

isReadShutdownback to summary
public boolean isReadShutdown()

Overrides org.xnio.Connection.isReadShutdown.

Doc from org.xnio.Connection.isReadShutdown.

Determine whether reads have been shut down on this connection.

Returns:boolean

true if reads were shut down

Annotations
@Override
isWriteShutdownback to summary
public boolean isWriteShutdown()

Overrides org.xnio.Connection.isWriteShutdown.

Determine whether writes have been shut down on this connection.

Returns:boolean

true if writes were shut down

notifyReadClosedback to summary
protected void notifyReadClosed()

Overrides org.xnio.StreamConnection.notifyReadClosed.

Doc from org.xnio.Connection.notifyReadClosed.

Indicate to conduit handlers that reads have been closed.

Annotations
@Override
notifyWriteClosedback to summary
protected void notifyWriteClosed()

Overrides org.xnio.StreamConnection.notifyWriteClosed.

Doc from org.xnio.Connection.notifyWriteClosed.

Indicate to conduit handlers that writes have been closed.

Annotations
@Override
readClosedback to summary
protected boolean readClosed()

Overrides org.xnio.Connection.readClosed.

Doc from org.xnio.Connection.readClosed.

Indicate that reads have been closed on this connection.

Returns:boolean

true if read closure was successfully indicated; false if this method has already been called

setOptionback to summary
public <T> T setOption(final Option<T> option, final T value) throws IllegalArgumentException, IOException

Overrides org.xnio.Connection.setOption.

Implements org.xnio.channels.Configurable.setOption.

Doc from org.xnio.channels.Configurable.setOption.

Set an option for this channel. Unsupported options are ignored.

Parameters
<T>
the type of the option value
option:Option<T>

the option to set

value:T

the value of the option to set

Returns:T

the previous option value, if any

Annotations
@Override
Exceptions
IllegalArgumentException:
if the value is not acceptable for this option
IOException:
if an I/O error occurred when modifying the option
startHandshakeback to summary
public synchronized void startHandshake() throws IOException

Implements abstract org.xnio.ssl.SslConnection.startHandshake.

Implements org.xnio.channels.SslChannel.startHandshake.

Doc from org.xnio.ssl.SslConnection.startHandshake.

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.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
supportsOptionback to summary
public boolean supportsOption(final Option<?> option)

Overrides org.xnio.Connection.supportsOption.

Implements org.xnio.channels.Configurable.supportsOption.

Doc from org.xnio.channels.Configurable.supportsOption.

Determine whether an option is supported on this channel.

Parameters
option:Option<?>

the option

Returns:boolean

true if it is supported

Annotations
@Override
writeClosedback to summary
protected boolean writeClosed()

Overrides org.xnio.Connection.writeClosed.

Doc from org.xnio.Connection.writeClosed.

Indicate that writes have been closed on this connection.

Returns:boolean

true if write closure was successfully indicated; false if this method has already been called