SSLIOSession is a decorator class intended to transparently extend
an IOSession with transport layer security capabilities based on
the SSL/TLS protocol.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static enum |
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private static final ByteBuffer | |
| private volatile boolean | |
| private final AtomicReference | |
| private final AtomicReference | |
| private final Timeout | |
| private final SSLManagedBuffer | |
| private final SSLSessionInitializer | |
| private final SSLManagedBuffer | |
| private final IOEventHandler | |
| private final AtomicInteger | |
| private final SSLManagedBuffer | |
| private final IOSession | |
| private final Callback | |
| private final Callback | |
| private volatile Timeout | |
| private final SSLEngine | |
| private final SSLMode | |
| private volatile IOSession. | |
| private final NamedEndpoint | |
| private volatile TlsDetails | |
| private final SSLSessionVerifier |
| Access | Constructor and Description |
|---|---|
| public | SSLIOSession(final NamedEndpoint
target endpoint (applicable in client mode only). May be targetEndpoint, final IOSession null.I/O session to be decorated with the TLS/SSL capabilities. session, final SSLMode SSL mode (client or server) sslMode, final SSLContext SSL context to use for this I/O session. sslContext, final SSLBufferMode buffer management mode sslBufferMode, final SSLSessionInitializer optional SSL session initializer. May be initializer, final SSLSessionVerifier null.optional SSL session verifier. May be verifier, final Callback<SSLIOSession> sessionStartCallback, final Callback<SSLIOSession> sessionEndCallback, final Timeout null.timeout to apply for the TLS/SSL handshake. May be connectTimeout)null.Creates new instance of |
| public | SSLIOSession(final NamedEndpoint
target endpoint (applicable in client mode only). May be targetEndpoint, final IOSession null.I/O session to be decorated with the TLS/SSL capabilities. session, final SSLMode SSL mode (client or server) sslMode, final SSLContext SSL context to use for this I/O session. sslContext, final SSLBufferMode buffer management mode sslBufferMode, final SSLSessionInitializer optional SSL session initializer. May be initializer, final SSLSessionVerifier null.optional SSL session verifier. May be verifier, final Timeout null.timeout to apply for the TLS/SSL handshake. May be handshakeTimeout, final Callback<SSLIOSession> sessionStartCallback, final Callback<SSLIOSession> sessionEndCallback, final FutureCallback<SSLSession> null.result callback. May be resultCallback)null.Creates new instance of |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public ByteChannel | channel()
Implements org. |
| public void | clearEvent(final int
I/O event type. op)Implements org. |
| public void | close()
Implements org. |
| public void | close(final CloseMode
How to close the receiver. closeMode)Implements org. |
| private SSLException | |
| private void | |
| private void | |
| private void | |
| private SSLEngineResult | |
| private SSLEngineResult | |
| private void | |
| public void | |
| private IOEventHandler | |
| private static void | |
| public int | getEventMask()
Implements org. |
| public IOEventHandler | getHandler()
Implements org. |
| public String | |
| public long | getLastEventTime()
Implements org. |
| public long | getLastReadTime()
Implements org. |
| public long | getLastWriteTime()
Implements org. |
| public SocketAddress | getLocalAddress()
Implements org. |
| public Lock | getLock()
Implements org. |
| public SocketAddress | getRemoteAddress()
Implements org. |
| public Timeout | getSocketTimeout()
Implements org. |
| public IOSession. | getStatus()
Implements org.
|
| public TlsDetails | |
| public boolean | hasCommands()
Implements org. |
| private void | |
| public boolean | |
| public Command | poll()
Implements org. Command from the command queue if available.
|
| public int | read(final ByteBuffer
The buffer into which bytes are to be transferred dst)Implements java. |
| private int | |
| private int | |
| public void | setEvent(final int
I/O event type. op)Implements org. |
| public void | setEventMask(final int
new I/O event mask. ops)Implements org. |
| public void | setSocketTimeout(final Timeout
socket timeout. timeout)Implements org. |
| public String | |
| private void | |
| public void | updateReadTime()
Implements org. |
| public void | updateWriteTime()
Implements org. |
| public void | upgrade(final IOEventHandler handler)
Implements org. |
| public int | write(final ByteBuffer
The buffer from which bytes are to be retrieved src)Implements java. |
| appEventMask | back to summary |
|---|---|
| private int appEventMask | |
| EMPTY_BUFFER | back to summary |
|---|---|
| private static final ByteBuffer EMPTY_BUFFER | |
| endOfStream | back to summary |
|---|---|
| private volatile boolean endOfStream | |
| handshakeCallbackRef | back to summary |
|---|---|
| private final AtomicReference<FutureCallback<SSLSession>> handshakeCallbackRef | |
| handshakeStateRef | back to summary |
|---|---|
| private final AtomicReference<SSLIOSession. | |
| handshakeTimeout | back to summary |
|---|---|
| private final Timeout handshakeTimeout | |
| inEncrypted | back to summary |
|---|---|
| private final SSLManagedBuffer inEncrypted | |
| initializer | back to summary |
|---|---|
| private final SSLSessionInitializer initializer | |
| inPlain | back to summary |
|---|---|
| private final SSLManagedBuffer inPlain | |
| internalEventHandler | back to summary |
|---|---|
| private final IOEventHandler internalEventHandler | |
| outboundClosedCount | back to summary |
|---|---|
| private final AtomicInteger outboundClosedCount | |
| outEncrypted | back to summary |
|---|---|
| private final SSLManagedBuffer outEncrypted | |
| session | back to summary |
|---|---|
| private final IOSession session | |
| sessionEndCallback | back to summary |
|---|---|
| private final Callback<SSLIOSession> sessionEndCallback | |
| sessionStartCallback | back to summary |
|---|---|
| private final Callback<SSLIOSession> sessionStartCallback | |
| socketTimeout | back to summary |
|---|---|
| private volatile Timeout socketTimeout | |
| sslEngine | back to summary |
|---|---|
| private final SSLEngine sslEngine | |
| sslMode | back to summary |
|---|---|
| private final SSLMode sslMode | |
| status | back to summary |
|---|---|
| private volatile IOSession. | |
| targetEndpoint | back to summary |
|---|---|
| private final NamedEndpoint targetEndpoint | |
| tlsDetails | back to summary |
|---|---|
| private volatile TlsDetails tlsDetails | |
| verifier | back to summary |
|---|---|
| private final SSLSessionVerifier verifier | |
| SSLIOSession | back to summary |
|---|---|
| public SSLIOSession(final NamedEndpoint targetEndpoint, final IOSession session, final SSLMode sslMode, final SSLContext sslContext, final SSLBufferMode sslBufferMode, final SSLSessionInitializer initializer, final SSLSessionVerifier verifier, final Callback<SSLIOSession> sessionStartCallback, final Callback<SSLIOSession> sessionEndCallback, final Timeout connectTimeout) Creates new instance of
| |
| SSLIOSession | back to summary |
|---|---|
| public SSLIOSession(final NamedEndpoint targetEndpoint, final IOSession session, final SSLMode sslMode, final SSLContext sslContext, final SSLBufferMode sslBufferMode, final SSLSessionInitializer initializer, final SSLSessionVerifier verifier, final Timeout handshakeTimeout, final Callback<SSLIOSession> sessionStartCallback, final Callback<SSLIOSession> sessionEndCallback, final FutureCallback<SSLSession> resultCallback) Creates new instance of
| |
| beginHandshake | back to summary |
|---|---|
| public void beginHandshake(final IOSession protocolSession) throws IOException | |
| channel | back to summary |
|---|---|
| public ByteChannel channel() Implements org. Doc from org. Returns the underlying I/O channel associated with this session.
| |
| clearEvent | back to summary |
|---|---|
| public void clearEvent(final int op) Implements org. Doc from org. Clears interest in a particular I/O event type by updating the event mask associated with the session.
| |
| close | back to summary |
|---|---|
| public void close() Implements org. Doc from org. Terminates the session gracefully and closes the underlying I/O channel. This method ensures that session termination handshake, such as the one used by the SSL/TLS protocol, is correctly carried out.
| |
| close | back to summary |
|---|---|
| public void close(final CloseMode closeMode) Implements org. Doc from org. Closes this process or endpoint and releases any system resources associated with it. If the endpoint or the process is already closed then invoking this method has no effect. | |
| convert | back to summary |
|---|---|
| private SSLException convert(final RuntimeException ex) | |
| decryptData | back to summary |
|---|---|
| private void decryptData(final IOSession protocolSession) throws IOException | |
| doHandshake | back to summary |
|---|---|
| private void doHandshake(final IOSession protocolSession) throws IOException | |
| doRunTask | back to summary |
|---|---|
| private void doRunTask() | |
| doUnwrap | back to summary |
|---|---|
| private SSLEngineResult doUnwrap(final ByteBuffer src, final ByteBuffer dst) throws SSLException | |
| doWrap | back to summary |
|---|---|
| private SSLEngineResult doWrap(final ByteBuffer src, final ByteBuffer dst) throws SSLException | |
| encryptData | back to summary |
|---|---|
| private void encryptData(final IOSession protocolSession) throws IOException | |
| enqueue | back to summary |
|---|---|
| public void enqueue(final Command command, final Command. Implements org. Doc from org. Inserts
| |
| ensureHandler | back to summary |
|---|---|
| private IOEventHandler ensureHandler() | |
| formatOps | back to summary |
|---|---|
| private static void formatOps(final StringBuilder buffer, final int ops) | |
| getEventMask | back to summary |
|---|---|
| public int getEventMask() Implements org. Doc from org. Returns mask of I/O evens this session declared interest in.
| |
| getHandler | back to summary |
|---|---|
| public IOEventHandler getHandler() Implements org. Doc from org. Returns event handler associated with the session.
| |
| getId | back to summary |
|---|---|
| public String getId() Implements org.
| |
| getLastEventTime | back to summary |
|---|---|
| public long getLastEventTime() Implements org. Doc from org. Returns timestamp of the last I/O event including socket timeout reset.
| |
| getLastReadTime | back to summary |
|---|---|
| public long getLastReadTime() Implements org. Doc from org. Returns timestamp of the last read event.
| |
| getLastWriteTime | back to summary |
|---|---|
| public long getLastWriteTime() Implements org. Doc from org. Returns timestamp of the last write event.
| |
| getLocalAddress | back to summary |
|---|---|
| public SocketAddress getLocalAddress() Implements org. Doc from org. Returns local address.
| |
| getLock | back to summary |
|---|---|
| public Lock getLock() Implements org. Doc from org. Returns session lock that should be used by I/O event handlers to synchronize access to the session.
| |
| getRemoteAddress | back to summary |
|---|---|
| public SocketAddress getRemoteAddress() Implements org. Doc from org. Returns address of the remote peer.
| |
| getSocketTimeout | back to summary |
|---|---|
| public Timeout getSocketTimeout() Implements org. Doc from org. Returns value of the socket timeout in milliseconds. The value of
| |
| getStatus | back to summary |
|---|---|
| public IOSession. Implements org. Doc from org. Returns status of the session:
| |
| getTlsDetails | back to summary |
|---|---|
| public TlsDetails getTlsDetails() | |
| hasCommands | back to summary |
|---|---|
| public boolean hasCommands() Implements org. Doc from org. Tests if there enqueued commands pending execution.
| |
| initialize | back to summary |
|---|---|
| private void initialize(final IOSession protocolSession) throws IOException | |
| isOpen | back to summary |
|---|---|
| public boolean isOpen() Implements java. Doc from java. Tells whether or not this channel is open.
| |
| poll | back to summary |
|---|---|
| public Command poll() Implements org. Doc from org. Removes first
| |
| read | back to summary |
|---|---|
| public int read(final ByteBuffer dst) Implements java. Doc from java. Reads a sequence of bytes from this channel into the given buffer. An attempt is made to read up to r bytes from the channel,
where r is the number of bytes remaining in the buffer, that is,
Suppose that a byte sequence of length n is read, where
A read operation might not fill the buffer, and in fact it might not read any bytes at all. Whether or not it does so depends upon the nature and state of the channel. A socket channel in non-blocking mode, for example, cannot read any more bytes than are immediately available from the socket's input buffer; similarly, a file channel cannot read any more bytes than remain in the file. It is guaranteed, however, that if a channel is in blocking mode and there is at least one byte remaining in the buffer then this method will block until at least one byte is read. This method may be invoked at any time. If another thread has already initiated a read operation upon this channel, however, then an invocation of this method will block until the first operation is complete.
| |
| receiveEncryptedData | back to summary |
|---|---|
| private int receiveEncryptedData() throws IOException | |
| sendEncryptedData | back to summary |
|---|---|
| private int sendEncryptedData() throws IOException | |
| setEvent | back to summary |
|---|---|
| public void setEvent(final int op) Implements org. Doc from org. Declares interest in a particular I/O event type by updating the event mask associated with the session.
| |
| setEventMask | back to summary |
|---|---|
| public void setEventMask(final int ops) Implements org. Doc from org. Declares interest in I/O event notifications by setting the event mask associated with the session
| |
| setSocketTimeout | back to summary |
|---|---|
| public void setSocketTimeout(final Timeout timeout) Implements org. Doc from org. Sets value of the socket timeout in milliseconds. The value of
Please note this operation may affect the last event time. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| updateEventMask | back to summary |
|---|---|
| private void updateEventMask() | |
| updateReadTime | back to summary |
|---|---|
| public void updateReadTime() Implements org. Doc from org. Updates the timestamp of the last read event
| |
| updateWriteTime | back to summary |
|---|---|
| public void updateWriteTime() Implements org. Doc from org. Updates the timestamp of the last write event
| |
| upgrade | back to summary |
|---|---|
| public void upgrade(final IOEventHandler handler) Implements org. Doc from org. Upgrades event handler associated with the session.
| |
| write | back to summary |
|---|---|
| public int write(final ByteBuffer src) throws IOException Implements java. Doc from java. Writes a sequence of bytes to this channel from the given buffer. An attempt is made to write up to r bytes to the channel,
where r is the number of bytes remaining in the buffer, that is,
Suppose that a byte sequence of length n is written, where
Unless otherwise specified, a write operation will return only after writing all of the r requested bytes. Some types of channels, depending upon their state, may write only some of the bytes or possibly none at all. A socket channel in non-blocking mode, for example, cannot write any more bytes than are free in the socket's output buffer. This method may be invoked at any time. If another thread has already initiated a write operation upon this channel, however, then an invocation of this method will block until the first operation is complete.
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final SSLIOSession. | |
| public static final SSLIOSession. | |
| public static final SSLIOSession. | |
| public static final SSLIOSession. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static SSLIOSession. | |
| public static SSLIOSession. |
| COMPLETE | back to summary |
|---|---|
| public static final SSLIOSession. | |
| HANDSHAKING | back to summary |
|---|---|
| public static final SSLIOSession. | |
| INITIALIZED | back to summary |
|---|---|
| public static final SSLIOSession. | |
| READY | back to summary |
|---|---|
| public static final SSLIOSession. | |
| TLSHandShakeState | back to summary |
|---|---|
| private TLSHandShakeState() | |
| valueOf | back to summary |
|---|---|
| public static SSLIOSession. | |
| values | back to summary |
|---|---|
| public static SSLIOSession. | |