public final class AsyncSslSocket extends Object implements AsyncTcpSocket, AsyncTcpSocket.EventHandler
AsyncTcpSocket.EventHandler| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes socket, regardless of any remaining buffered data.
|
static AsyncSslSocket |
create(Eventloop eventloop,
AsyncTcpSocket asyncTcpSocket,
SSLEngine engine,
Executor executor) |
InetSocketAddress |
getRemoteSocketAddress() |
void |
onClosedWithError(Exception e)
Is called when socket is closed with error.
|
void |
onRead(ByteBuf buf)
Is called when new input data was received by socket.
|
void |
onReadEndOfStream()
Is called when other side closed output, namely other side won't send any more data
|
void |
onRegistered() |
void |
onWrite()
Is called when all buffered data is flushed to network.
|
void |
read()
Must be called to inform the async socket that additional read data is needed.
|
void |
setEventHandler(AsyncTcpSocket.EventHandler eventHandler) |
static AsyncSslSocket |
wrapClientSocket(Eventloop eventloop,
AsyncTcpSocket asyncTcpSocket,
SSLContext sslContext,
Executor executor) |
static AsyncSslSocket |
wrapClientSocket(Eventloop eventloop,
AsyncTcpSocket asyncTcpSocket,
String host,
int port,
SSLContext sslContext,
Executor executor) |
static AsyncSslSocket |
wrapServerSocket(Eventloop eventloop,
AsyncTcpSocket asyncTcpSocket,
SSLContext sslContext,
Executor executor) |
static AsyncSslSocket |
wrapSocket(Eventloop eventloop,
AsyncTcpSocket asyncTcpSocket,
SSLEngine engine,
Executor executor) |
void |
write(ByteBuf buf)
Asynchronously writes data to network.
|
void |
writeEndOfStream()
Informs socket that no more data will be written.
|
public static AsyncSslSocket wrapClientSocket(Eventloop eventloop, AsyncTcpSocket asyncTcpSocket, String host, int port, SSLContext sslContext, Executor executor)
public static AsyncSslSocket wrapClientSocket(Eventloop eventloop, AsyncTcpSocket asyncTcpSocket, SSLContext sslContext, Executor executor)
public static AsyncSslSocket wrapServerSocket(Eventloop eventloop, AsyncTcpSocket asyncTcpSocket, SSLContext sslContext, Executor executor)
public static AsyncSslSocket wrapSocket(Eventloop eventloop, AsyncTcpSocket asyncTcpSocket, SSLEngine engine, Executor executor)
public static AsyncSslSocket create(Eventloop eventloop, AsyncTcpSocket asyncTcpSocket, SSLEngine engine, Executor executor)
public void onRegistered()
onRegistered in interface AsyncTcpSocket.EventHandlerpublic void onRead(ByteBuf buf)
AsyncTcpSocket.EventHandler
This callback is called only after one or more AsyncTcpSocket.read() invocation,
If this callback has been called, but event handler is still interested in reading data from socket,
AsyncTcpSocket.read() method must be called
onRead in interface AsyncTcpSocket.EventHandlerbuf - input datapublic void onReadEndOfStream()
AsyncTcpSocket.EventHandleronReadEndOfStream in interface AsyncTcpSocket.EventHandlerpublic void onWrite()
AsyncTcpSocket.EventHandlerAsyncTcpSocket.write(ByteBuf) invocation,
unless the socket is closed.onWrite in interface AsyncTcpSocket.EventHandlerpublic void onClosedWithError(Exception e)
AsyncTcpSocket.EventHandleronClosedWithError in interface AsyncTcpSocket.EventHandlerpublic void setEventHandler(AsyncTcpSocket.EventHandler eventHandler)
setEventHandler in interface AsyncTcpSocketpublic void read()
AsyncTcpSocket
Unless called, the socket won't read any data from network
and therefore won't invoke AsyncTcpSocket.EventHandler.onRead(ByteBuf) callback.
Each read invocation may result in at most one
AsyncTcpSocket.EventHandler.onRead(ByteBuf) callbacks.
This operation is idempotent and may be called several times prior to actual onRead callbacks.
read in interface AsyncTcpSocketpublic void write(ByteBuf buf)
AsyncTcpSocket
When written data is flushed, AsyncTcpSocket.EventHandler.onWrite() method will be called
write in interface AsyncTcpSocketbuf - bytes of datapublic void writeEndOfStream()
AsyncTcpSocketAsyncTcpSocket.EventHandler.onWrite() confirmation.
This operation is idempotent.
No subsequent AsyncTcpSocket.EventHandler.onWrite() operations on the socket must be called afterwards.writeEndOfStream in interface AsyncTcpSocketpublic void close()
AsyncTcpSocketAfter calling this method no more event handler methods will be invoked
close in interface AsyncTcpSocketpublic InetSocketAddress getRemoteSocketAddress()
getRemoteSocketAddress in interface AsyncTcpSocketCopyright © 2019. All rights reserved.