@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| 构造器和说明 |
|---|
SSLIOSession(NamedEndpoint targetEndpoint,
IOSession session,
SSLMode sslMode,
SSLContext sslContext,
SSLBufferMode sslBufferMode,
SSLSessionInitializer initializer,
SSLSessionVerifier verifier,
Callback<SSLIOSession> sessionStartCallback,
Callback<SSLIOSession> sessionEndCallback,
Timeout connectTimeout)
Creates new instance of
SSLIOSession class. |
SSLIOSession(NamedEndpoint targetEndpoint,
IOSession session,
SSLMode sslMode,
SSLContext sslContext,
SSLBufferMode sslBufferMode,
SSLSessionInitializer initializer,
SSLSessionVerifier verifier,
Timeout handshakeTimeout,
Callback<SSLIOSession> sessionStartCallback,
Callback<SSLIOSession> sessionEndCallback,
FutureCallback<SSLSession> resultCallback)
Creates new instance of
SSLIOSession class. |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
beginHandshake(IOSession protocolSession) |
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:
IOSession.Status.ACTIVE: session is active. |
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> sessionStartCallback, Callback<SSLIOSession> sessionEndCallback, 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 SSLIOSession(NamedEndpoint targetEndpoint, IOSession session, SSLMode sslMode, SSLContext sslContext, SSLBufferMode sslBufferMode, SSLSessionInitializer initializer, SSLSessionVerifier verifier, Timeout handshakeTimeout, Callback<SSLIOSession> sessionStartCallback, Callback<SSLIOSession> sessionEndCallback, FutureCallback<SSLSession> resultCallback)
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.handshakeTimeout - timeout to apply for the TLS/SSL handshake. May be null.resultCallback - result callback. May be null.public IOEventHandler getHandler()
IOSessiongetHandler 在接口中 IOSessionpublic void beginHandshake(IOSession protocolSession) throws IOException
IOExceptionpublic int write(ByteBuffer src) throws IOException
write 在接口中 WritableByteChannelIOExceptionpublic int read(ByteBuffer dst)
read 在接口中 ReadableByteChannelpublic String getId()
getId 在接口中 Identifiablepublic Lock getLock()
IOSessionpublic void upgrade(IOEventHandler handler)
IOSessionpublic TlsDetails getTlsDetails()
public void close()
IOSessionpublic void close(CloseMode closeMode)
ModalCloseableclose 在接口中 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 在接口中 IOSessionpublic Command poll()
IOSessionCommand from the command queue if available.public ByteChannel channel()
IOSessionpublic SocketAddress getLocalAddress()
IOSessiongetLocalAddress 在接口中 IOSessionpublic SocketAddress getRemoteAddress()
IOSessiongetRemoteAddress 在接口中 IOSessionpublic int getEventMask()
IOSessiongetEventMask 在接口中 IOSessionpublic void setEventMask(int ops)
IOSessionsetEventMask 在接口中 IOSessionops - new I/O event mask.public void setEvent(int op)
IOSessionpublic void clearEvent(int op)
IOSessionclearEvent 在接口中 IOSessionop - I/O event type.public Timeout getSocketTimeout()
IOSession0 signifies the session cannot time out.getSocketTimeout 在接口中 SocketModalCloseablegetSocketTimeout 在接口中 IOSessionpublic void setSocketTimeout(Timeout timeout)
IOSession0 signifies the session cannot time out.
Please note this operation may affect the last event time.
setSocketTimeout 在接口中 SocketModalCloseablesetSocketTimeout 在接口中 IOSessiontimeout - socket timeout.IOSession.getLastEventTime()public void updateReadTime()
IOSessionupdateReadTime 在接口中 IOSessionpublic void updateWriteTime()
IOSessionupdateWriteTime 在接口中 IOSessionpublic long getLastReadTime()
IOSessiongetLastReadTime 在接口中 IOSessionpublic long getLastWriteTime()
IOSessiongetLastWriteTime 在接口中 IOSessionpublic long getLastEventTime()
IOSessiongetLastEventTime 在接口中 IOSessionIOSession.getSocketTimeout()Copyright © 2023. All rights reserved.