java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.ByteChannel, java.nio.channels.Channel, java.nio.channels.ReadableByteChannel, java.nio.channels.WritableByteChannel, WrappedByteChannelpublic class SSLSocketChannel2 extends java.lang.Object implements java.nio.channels.ByteChannel, WrappedByteChannel
| Modifier and Type | Field | Description |
|---|---|---|
protected int |
bufferallocations |
Should be used to count the buffer allocations.
|
protected static java.nio.ByteBuffer |
emptybuffer |
This object is used to feed the
SSLEngine's wrap and unwrap methods during the handshake phase. |
protected java.util.concurrent.ExecutorService |
exec |
|
protected java.nio.ByteBuffer |
inCrypt |
encrypted data incoming
|
protected java.nio.ByteBuffer |
inData |
raw payload incomming
|
protected java.nio.ByteBuffer |
outCrypt |
encrypted data outgoing
|
protected javax.net.ssl.SSLEngineResult |
readEngineResult |
|
protected java.nio.channels.SelectionKey |
selectionKey |
used to set interestOP SelectionKey.OP_WRITE for the underlying channel
|
protected java.nio.channels.SocketChannel |
socketChannel |
the underlying channel
|
protected javax.net.ssl.SSLEngine |
sslEngine |
|
protected java.util.List<java.util.concurrent.Future<?>> |
tasks |
|
protected javax.net.ssl.SSLEngineResult |
writeEngineResult |
| Constructor | Description |
|---|---|
SSLSocketChannel2(java.nio.channels.SocketChannel channel,
javax.net.ssl.SSLEngine sslEngine,
java.util.concurrent.ExecutorService exec,
java.nio.channels.SelectionKey key) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
|
java.nio.channels.SelectableChannel |
configureBlocking(boolean b) |
|
boolean |
connect(java.net.SocketAddress remote) |
|
protected void |
consumeDelegatedTasks() |
|
protected void |
createBuffers(javax.net.ssl.SSLSession session) |
|
boolean |
finishConnect() |
|
boolean |
isBlocking() |
This function returns the blocking state of the channel
|
boolean |
isConnected() |
|
boolean |
isInboundDone() |
|
boolean |
isNeedRead() |
returns whether readMore should be called to fetch data which has been decoded but not yet been returned.
|
boolean |
isNeedWrite() |
returns whether writeMore should be called write additional data.
|
boolean |
isOpen() |
|
int |
read(java.nio.ByteBuffer dst) |
Blocks when in blocking mode until at least one byte has been decoded.
When not in blocking mode 0 may be returned. |
int |
readMore(java.nio.ByteBuffer dst) |
This function does not read data from the underlying channel at all.
|
java.net.Socket |
socket() |
|
int |
write(java.nio.ByteBuffer src) |
|
void |
writeMore() |
Gets called when
WrappedByteChannel.isNeedWrite() ()} requires a additional rite |
protected static java.nio.ByteBuffer emptybuffer
SSLEngine's wrap and unwrap methods during the handshake phase.protected java.util.concurrent.ExecutorService exec
protected java.util.List<java.util.concurrent.Future<?>> tasks
protected java.nio.ByteBuffer inData
protected java.nio.ByteBuffer outCrypt
protected java.nio.ByteBuffer inCrypt
protected java.nio.channels.SocketChannel socketChannel
protected java.nio.channels.SelectionKey selectionKey
protected javax.net.ssl.SSLEngine sslEngine
protected javax.net.ssl.SSLEngineResult readEngineResult
protected javax.net.ssl.SSLEngineResult writeEngineResult
protected int bufferallocations
createBuffers(SSLSession) needs to be called.public SSLSocketChannel2(java.nio.channels.SocketChannel channel,
javax.net.ssl.SSLEngine sslEngine,
java.util.concurrent.ExecutorService exec,
java.nio.channels.SelectionKey key)
throws java.io.IOException
java.io.IOExceptionprotected void consumeDelegatedTasks()
protected void createBuffers(javax.net.ssl.SSLSession session)
public int write(java.nio.ByteBuffer src)
throws java.io.IOException
write in interface java.nio.channels.WritableByteChanneljava.io.IOExceptionpublic int read(java.nio.ByteBuffer dst)
throws java.io.IOException
read in interface java.nio.channels.ReadableByteChanneljava.io.IOExceptionpublic boolean isConnected()
public void close()
throws java.io.IOException
close in interface java.lang.AutoCloseableclose in interface java.nio.channels.Channelclose in interface java.io.Closeablejava.io.IOExceptionpublic java.nio.channels.SelectableChannel configureBlocking(boolean b)
throws java.io.IOException
java.io.IOExceptionpublic boolean connect(java.net.SocketAddress remote)
throws java.io.IOException
java.io.IOExceptionpublic boolean finishConnect()
throws java.io.IOException
java.io.IOExceptionpublic java.net.Socket socket()
public boolean isInboundDone()
public boolean isOpen()
isOpen in interface java.nio.channels.Channelpublic boolean isNeedWrite()
WrappedByteChannelisNeedWrite in interface WrappedByteChannelpublic void writeMore()
throws java.io.IOException
WrappedByteChannelWrappedByteChannel.isNeedWrite() ()} requires a additional ritewriteMore in interface WrappedByteChanneljava.io.IOException - may be thrown due to an error while writingpublic boolean isNeedRead()
WrappedByteChannelisNeedRead in interface WrappedByteChannelReadableByteChannel.read(ByteBuffer),
WrappedByteChannel.readMore(ByteBuffer)public int readMore(java.nio.ByteBuffer dst)
throws javax.net.ssl.SSLException
WrappedByteChannelReadableByteChannel.read(ByteBuffer).readMore in interface WrappedByteChanneldst - the destiny of the readjavax.net.ssl.SSLExceptionpublic boolean isBlocking()
WrappedByteChannelisBlocking in interface WrappedByteChannel