-
- All Implemented Interfaces:
-
com.tds.common.websocket.conn.WrappedByteChannel
,com.tds.common.websocket.interfaces.ISSLChannel
,java.io.Closeable
,java.lang.AutoCloseable
,java.nio.channels.ByteChannel
,java.nio.channels.Channel
,java.nio.channels.ReadableByteChannel
,java.nio.channels.WritableByteChannel
public class SSLSocketChannel implements WrappedByteChannel, ByteChannel, ISSLChannel
A class that represents an SSL/TLS peer, and can be extended to create a client or a server.
It makes use of the JSSE framework, and specifically the SSLEngine logic, which is described by Oracle as "an advanced API, not appropriate for casual use", since it requires the user to implement much of the communication establishment procedure himself. More information about it can be found here: http://docs.oracle.com/javase/8/docs/technotes/guides/security/jsse/JSSERefGuide.html#SSLEngine
SSLSocketChannel implements the handshake protocol, required to establish a connection between two peers, which is common for both client and server and provides the abstract and write (String)} methods, that need to be implemented by the specific SSL/TLS peer that is going to extend this class.
-
-
Constructor Summary
Constructors Constructor Description SSLSocketChannel(SocketChannel inputSocketChannel, SSLEngine inputEngine, ExecutorService inputExecutor, SelectionKey key)
-
Method Summary
Modifier and Type Method Description synchronized int
read(ByteBuffer dst)
synchronized int
write(ByteBuffer output)
boolean
isNeedWrite()
returns whether writeMore should be called write additional data. void
writeMore()
Gets called when isNeedWrite ()} requires a additional rite boolean
isNeedRead()
returns whether readMore should be called to fetch data which has been decoded but not yet beenreturned. int
readMore(ByteBuffer dst)
This function does not read data from the underlying channel at all. boolean
isBlocking()
This function returns the blocking state of the channel boolean
isOpen()
void
close()
SSLEngine
getSSLEngine()
Get the ssl engine used for the de- and encryption of the communication. -
Methods inherited from class java.nio.channels.ReadableByteChannel
read
-
Methods inherited from class java.nio.channels.Channel
close, isOpen
-
Methods inherited from class java.nio.channels.WritableByteChannel
write
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
SSLSocketChannel
SSLSocketChannel(SocketChannel inputSocketChannel, SSLEngine inputEngine, ExecutorService inputExecutor, SelectionKey key)
-
-
Method Detail
-
read
synchronized int read(ByteBuffer dst)
-
write
synchronized int write(ByteBuffer output)
-
isNeedWrite
boolean isNeedWrite()
returns whether writeMore should be called write additional data.
-
writeMore
void writeMore()
Gets called when isNeedWrite ()} requires a additional rite
-
isNeedRead
boolean isNeedRead()
returns whether readMore should be called to fetch data which has been decoded but not yet beenreturned.
-
readMore
int readMore(ByteBuffer dst)
This function does not read data from the underlying channel at all. It is just a way to fetchdata which has already be received or decoded but was but was not yet returned to the user.This could be the case when the decoded data did not fit into the buffer the user passed to read.
- Parameters:
dst
- the destiny of the read
-
isBlocking
boolean isBlocking()
This function returns the blocking state of the channel
-
isOpen
boolean isOpen()
-
close
void close()
-
getSSLEngine
SSLEngine getSSLEngine()
Get the ssl engine used for the de- and encryption of the communication.
-
-
-
-