@Contract(threading=SAFE_CONDITIONAL) @Internal public class SSLIOSession extends Object implements IOSession
SSLIOSession is a decorator class intended to transparently extend
an IOSession with transport layer security capabilities based on
the SSL/TLS protocol.IOSession.Status| Constructor and Description |
|---|
SSLIOSession(NamedEndpoint targetEndpoint,
IOSession session,
SSLMode sslMode,
SSLContext sslContext,
SSLBufferMode sslBufferMode,
SSLSessionInitializer initializer,
SSLSessionVerifier verifier,
Callback<SSLIOSession> connectedCallback,
Callback<SSLIOSession> disconnectedCallback,
Timeout connectTimeout)
Creates new instance of
SSLIOSession class. |
| Modifier and Type | Method and Description |
|---|---|
ByteChannel |
channel()
Returns the underlying I/O channel associated with this session.
|
void |
clearEvent(int op)
Clears interest in a particular I/O event type by updating the event
mask associated with the session.
|
void |
close()
Terminates the session gracefully and closes the underlying I/O channel.
|
void |
close(CloseMode closeMode)
Closes this process or endpoint and releases any system resources associated
with it.
|
void |
enqueue(Command command,
Command.Priority priority)
Inserts
Command at the end of the command queue. |
int |
getEventMask()
Returns mask of I/O evens this session declared interest in.
|
IOEventHandler |
getHandler()
Returns event handler associated with the session.
|
String |
getId() |
long |
getLastEventTime()
Returns timestamp of the last I/O event including socket timeout reset.
|
long |
getLastReadTime()
Returns timestamp of the last read event.
|
long |
getLastWriteTime()
Returns timestamp of the last write event.
|
SocketAddress |
getLocalAddress()
Returns local address.
|
Lock |
getLock()
Returns session lock that should be used by I/O event handlers
to synchronize access to the session.
|
SocketAddress |
getRemoteAddress()
Returns address of the remote peer.
|
Timeout |
getSocketTimeout()
Returns value of the socket timeout in milliseconds.
|
IOSession.Status |
getStatus()
Returns status of the session:
|
TlsDetails |
getTlsDetails() |
boolean |
hasCommands()
Tests if there enqueued commands pending execution.
|
boolean |
isOpen() |
Command |
poll()
Removes first
Command from the command queue if available. |
int |
read(ByteBuffer dst) |
void |
setEvent(int op)
Declares interest in a particular I/O event type by updating the event
mask associated with the session.
|
void |
setEventMask(int ops)
Declares interest in I/O event notifications by setting the event mask
associated with the session
|
void |
setSocketTimeout(Timeout timeout)
Sets value of the socket timeout in milliseconds.
|
String |
toString() |
void |
updateReadTime()
Updates the timestamp of the last read event
|
void |
updateWriteTime()
Updates the timestamp of the last write event
|
void |
upgrade(IOEventHandler handler)
Upgrades event handler associated with the session.
|
int |
write(ByteBuffer src) |
public SSLIOSession(NamedEndpoint targetEndpoint, IOSession session, SSLMode sslMode, SSLContext sslContext, SSLBufferMode sslBufferMode, SSLSessionInitializer initializer, SSLSessionVerifier verifier, Callback<SSLIOSession> connectedCallback, Callback<SSLIOSession> disconnectedCallback, Timeout connectTimeout)
SSLIOSession class.session - I/O session to be decorated with the TLS/SSL capabilities.sslMode - SSL mode (client or server)targetEndpoint - target endpoint (applicable in client mode only). May be null.sslContext - SSL context to use for this I/O session.sslBufferMode - buffer management modeinitializer - optional SSL session initializer. May be null.verifier - optional SSL session verifier. May be null.connectTimeout - timeout to apply for the TLS/SSL handshake. May be null.public IOEventHandler getHandler()
IOSessiongetHandler in interface IOSessionpublic int write(ByteBuffer src) throws IOException
write in interface WritableByteChannelIOExceptionpublic int read(ByteBuffer dst)
read in interface ReadableByteChannelpublic String getId()
getId in interface Identifiablepublic Lock getLock()
IOSessionpublic void upgrade(IOEventHandler handler)
IOSessionpublic TlsDetails getTlsDetails()
public void close()
IOSessionpublic void close(CloseMode closeMode)
ModalCloseableclose in interface ModalCloseablecloseMode - How to close the receiver.public IOSession.Status getStatus()
IOSession
IOSession.Status.ACTIVE: session is active.
IOSession.Status.CLOSING: session is being closed.
IOSession.Status.CLOSED: session has been terminated.
public void enqueue(Command command, Command.Priority priority)
IOSessionCommand at the end of the command queue.public boolean hasCommands()
IOSessionhasCommands in interface IOSessionpublic Command poll()
IOSessionCommand from the command queue if available.public ByteChannel channel()
IOSessionpublic SocketAddress getLocalAddress()
IOSessiongetLocalAddress in interface IOSessionpublic SocketAddress getRemoteAddress()
IOSessiongetRemoteAddress in interface IOSessionpublic int getEventMask()
IOSessiongetEventMask in interface IOSessionpublic void setEventMask(int ops)
IOSessionsetEventMask in interface IOSessionops - new I/O event mask.public void setEvent(int op)
IOSessionpublic void clearEvent(int op)
IOSessionclearEvent in interface IOSessionop - I/O event type.public Timeout getSocketTimeout()
IOSession0 signifies the session cannot time out.getSocketTimeout in interface SocketModalCloseablegetSocketTimeout in interface IOSessionpublic void setSocketTimeout(Timeout timeout)
IOSession0 signifies the session cannot time out.
Please note this operation may affect the last event time.
setSocketTimeout in interface SocketModalCloseablesetSocketTimeout in interface IOSessiontimeout - socket timeout.IOSession.getLastEventTime()public void updateReadTime()
IOSessionupdateReadTime in interface IOSessionpublic void updateWriteTime()
IOSessionupdateWriteTime in interface IOSessionpublic long getLastReadTime()
IOSessiongetLastReadTime in interface IOSessionpublic long getLastWriteTime()
IOSessiongetLastWriteTime in interface IOSessionpublic long getLastEventTime()
IOSessiongetLastEventTime in interface IOSessionIOSession.getSocketTimeout()Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.