public class SSLSocketChannel2 extends java.lang.Object implements java.nio.channels.ByteChannel, WrappedByteChannel
| Modifier and Type | Field and 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 and 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 and 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() |
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() |
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() |
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.io.Closeableclose in interface java.lang.AutoCloseableclose in interface java.nio.channels.Channeljava.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()
isNeedWrite in interface WrappedByteChannelpublic void writeMore()
throws java.io.IOException
writeMore in interface WrappedByteChanneljava.io.IOExceptionpublic 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 WrappedByteChanneljavax.net.ssl.SSLExceptionpublic boolean isBlocking()
isBlocking in interface WrappedByteChannel