Class AsyncChannelWrapperSecure
java.lang.Object
org.apache.tomcat.websocket.AsyncChannelWrapperSecure
- All Implemented Interfaces:
AsyncChannelWrapper
Wraps the
AsynchronousSocketChannel with SSL/TLS. This needs a lot more testing before it can be considered
robust.-
Constructor Summary
ConstructorsConstructorDescriptionAsyncChannelWrapperSecure(AsynchronousSocketChannel socketChannel, SSLEngine sslEngine) Constructs a new secure wrapper for the given channel and SSL engine. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the underlying channel.Returns the local address to which the channel is bound.Performs the SSL/TLS handshake.read(ByteBuffer dst) Reads data from the channel into the given buffer.<B, A extends B>
voidread(ByteBuffer dst, A attachment, CompletionHandler<Integer, B> handler) Reads data from the channel into the given buffer with a completion handler.write(ByteBuffer src) Writes data from the given buffer to the channel.<B, A extends B>
voidwrite(ByteBuffer[] srcs, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long, B> handler) Writes data from the given buffers to the channel with a completion handler.
-
Constructor Details
-
AsyncChannelWrapperSecure
Constructs a new secure wrapper for the given channel and SSL engine.- Parameters:
socketChannel- the underlyingAsynchronousSocketChannelsslEngine- the SSL engine for encryption
-
-
Method Details
-
read
Description copied from interface:AsyncChannelWrapperReads data from the channel into the given buffer.- Specified by:
readin interfaceAsyncChannelWrapper- Parameters:
dst- the buffer into which data is to be read- Returns:
- a Future holding the number of bytes read
-
read
public <B, A extends B> void read(ByteBuffer dst, A attachment, CompletionHandler<Integer, B> handler) Description copied from interface:AsyncChannelWrapperReads data from the channel into the given buffer with a completion handler.- Specified by:
readin interfaceAsyncChannelWrapper- Type Parameters:
B- the attachment typeA- the attachment subtype- Parameters:
dst- the buffer into which data is to be readattachment- the object to attach to the taskhandler- the handler to use on completion
-
write
Description copied from interface:AsyncChannelWrapperWrites data from the given buffer to the channel.- Specified by:
writein interfaceAsyncChannelWrapper- Parameters:
src- the buffer from which data is to be written- Returns:
- a Future holding the number of bytes written
-
write
public <B, A extends B> void write(ByteBuffer[] srcs, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long, B> handler) Description copied from interface:AsyncChannelWrapperWrites data from the given buffers to the channel with a completion handler.- Specified by:
writein interfaceAsyncChannelWrapper- Type Parameters:
B- the attachment typeA- the attachment subtype- Parameters:
srcs- the buffers from which data is to be writtenoffset- the offset within the buffer arraylength- the number of buffers to writetimeout- the maximum time to waitunit- the time unit of the timeoutattachment- the object to attach to the taskhandler- the handler to use on completion
-
close
public void close()Description copied from interface:AsyncChannelWrapperCloses the underlying channel.- Specified by:
closein interfaceAsyncChannelWrapper
-
handshake
Description copied from interface:AsyncChannelWrapperPerforms the SSL/TLS handshake.- Specified by:
handshakein interfaceAsyncChannelWrapper- Returns:
- a Future that completes when the handshake is finished
- Throws:
SSLException- if an SSL error occurs
-
getLocalAddress
Description copied from interface:AsyncChannelWrapperReturns the local address to which the channel is bound.- Specified by:
getLocalAddressin interfaceAsyncChannelWrapper- Returns:
- the local socket address, or null if not bound
- Throws:
IOException- if an I/O error occurs
-