Package org.xnio.ssl
Class JsseSslStreamConnection
java.lang.Object
org.xnio.Connection
org.xnio.StreamConnection
org.xnio.ssl.SslConnection
org.xnio.ssl.JsseSslStreamConnection
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,InterruptibleChannel,BoundChannel,CloseableChannel,CloseListenerSettable<StreamConnection>,Configurable,ConnectedChannel,SslChannel
StreamConnection with SSL support.
- 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
threadFields inherited from interface org.xnio.channels.Configurable
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionJsseSslStreamConnection(StreamConnection connection, SSLEngine sslEngine, boolean startTls) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidThe close action to perform on this connection.ChannelListener.Setter<? extends SslConnection>Get the setter which can be used to change the handshake listener for this channel.Get the local address that this channel is bound to.<T> TGet the value of a channel option.Get the peer address of this channel.Get the currentSSLSessionfor this channel.protected voidCallback method for notification of handshake finished.booleanDetermine whether reads have been shut down on this connection.booleanDetermine whether writes have been shut down on this connection.protected voidIndicate to conduit handlers that reads have been closed.protected voidIndicate to conduit handlers that writes have been closed.protected booleanIndicate that reads have been closed on this connection.<T> TSet an option for this channel.voidStart or restart the SSL/TLS handshake.booleansupportsOption(Option<?> option) Determine whether an option is supported on this channel.protected booleanIndicate that writes have been closed on this connection.Methods inherited from class org.xnio.ssl.SslConnection
getCloseSetterMethods inherited from class org.xnio.StreamConnection
getCloseListener, getSinkChannel, getSourceChannel, setCloseListener, setSinkConduit, setSourceConduitMethods inherited from class org.xnio.Connection
close, getIoThread, getLocalAddress, getPeerAddress, getWorker, isOpenMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xnio.channels.BoundChannel
getLocalAddressMethods inherited from interface org.xnio.channels.CloseableChannel
close, getIoThread, getWorkerMethods inherited from interface org.xnio.channels.ConnectedChannel
getPeerAddress
-
Constructor Details
-
JsseSslStreamConnection
-
-
Method Details
-
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 theOptions.SSL_STARTTLSoption 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:
startHandshakein interfaceSslChannel- Specified by:
startHandshakein classSslConnection- Throws:
IOException- if an I/O error occurs
-
getPeerAddress
Get the peer address of this channel.- Returns:
- the peer address
-
getLocalAddress
Get the local address that this channel is bound to.- Returns:
- the local address
-
closeAction
The close action to perform on this connection.- Overrides:
closeActionin classConnection- Throws:
IOException- if close fails
-
notifyWriteClosed
protected void notifyWriteClosed()Indicate to conduit handlers that writes have been closed.- Overrides:
notifyWriteClosedin classStreamConnection
-
notifyReadClosed
protected void notifyReadClosed()Indicate to conduit handlers that reads have been closed.- Overrides:
notifyReadClosedin classStreamConnection
-
setOption
Set an option for this channel. Unsupported options are ignored.- Specified by:
setOptionin interfaceConfigurable- Overrides:
setOptionin classConnection- Type Parameters:
T- the type of the option value- Parameters:
option- the option to setvalue- the value of the option to set- Returns:
- the previous option value, if any
- Throws:
IllegalArgumentException- if the value is not acceptable for this optionIOException- if an I/O error occurred when modifying the option
-
getOption
Get the value of a channel option.- Specified by:
getOptionin interfaceConfigurable- Overrides:
getOptionin classConnection- Type Parameters:
T- the type of the option value- Parameters:
option- the option to get- Returns:
- the value of the option, or
nullif it is not set - Throws:
IOException- if an I/O error occurred when reading the option
-
supportsOption
Determine whether an option is supported on this channel.- Specified by:
supportsOptionin interfaceConfigurable- Overrides:
supportsOptionin classConnection- Parameters:
option- the option- Returns:
trueif it is supported
-
getSslSession
Get the currentSSLSessionfor this channel.- Specified by:
getSslSessionin interfaceSslChannel- Specified by:
getSslSessionin classSslConnection- Returns:
- the current
SSLSession
-
getHandshakeSetter
Description copied from class:SslConnectionGet the setter which can be used to change the handshake listener for this channel.- Specified by:
getHandshakeSetterin interfaceSslChannel- Specified by:
getHandshakeSetterin classSslConnection- Returns:
- the setter
-
readClosed
protected boolean readClosed()Description copied from class:ConnectionIndicate that reads have been closed on this connection.- Overrides:
readClosedin classConnection- Returns:
trueif read closure was successfully indicated;falseif this method has already been called
-
writeClosed
protected boolean writeClosed()Description copied from class:ConnectionIndicate that writes have been closed on this connection.- Overrides:
writeClosedin classConnection- Returns:
trueif write closure was successfully indicated;falseif this method has already been called
-
handleHandshakeFinished
protected void handleHandshakeFinished()Callback method for notification of handshake finished. -
isReadShutdown
public boolean isReadShutdown()Description copied from class:ConnectionDetermine whether reads have been shut down on this connection.- Overrides:
isReadShutdownin classConnection- Returns:
trueif reads were shut down
-
isWriteShutdown
public boolean isWriteShutdown()Determine whether writes have been shut down on this connection.- Overrides:
isWriteShutdownin classConnection- Returns:
trueif writes were shut down
-