org.apache.tomcat.util.net
public class SecureNioChannel extends NioChannel
Version: 1.0
| Nested Class Summary | |
|---|---|
| static interface | SecureNioChannel.ApplicationBufferHandler
Callback interface to be able to expand buffers
when buffer overflow exceptions happen |
| Field Summary | |
|---|---|
| protected boolean | closed |
| protected boolean | closing |
| protected boolean | initHandshakeComplete |
| protected HandshakeStatus | initHandshakeStatus |
| protected ByteBuffer | netInBuffer |
| protected ByteBuffer | netOutBuffer |
| protected NioSelectorPool | pool |
| protected SSLEngine | sslEngine |
| Constructor Summary | |
|---|---|
| SecureNioChannel(SocketChannel channel, SSLEngine engine, SecureNioChannel.ApplicationBufferHandler bufHandler, NioSelectorPool pool) | |
| Method Summary | |
|---|---|
| void | close()
Sends a SSL close message, will not physically close the connection here. To close the connection, you could do something like |
| void | close(boolean force)
Force a close, can throw an IOException |
| boolean | flush(boolean block, Selector s, long timeout, MutableInteger lastWrite)
returns true if the network buffer has
been flushed out and is empty |
| protected boolean | flush(ByteBuffer buf)
Flushes the buffer to the network, non blocking |
| int | getBufferSize() |
| SecureNioChannel.ApplicationBufferHandler | getBufHandler() |
| ByteBuffer | getEmptyBuf() |
| SocketChannel | getIOChannel() |
| SSLEngine | getSslEngine() |
| int | handshake(boolean read, boolean write)
Performs SSL handshake, non blocking, but performs NEED_TASK on the same thread. Hence, you should never call this method using your Acceptor thread, as you would slow down your system significantly. The return for this operation is 0 if the handshake is complete and a positive value if it is not complete. |
| protected SSLEngineResult | handshakeUnwrap(boolean doread)
Perform handshake unwrap |
| protected SSLEngineResult | handshakeWrap(boolean doWrite)
Performs the WRAP function |
| boolean | isClosing() |
| boolean | isInitHandshakeComplete() |
| int | read(ByteBuffer dst)
Reads a sequence of bytes from this channel into the given buffer.
|
| void | reset(SSLEngine engine) |
| void | reset() |
| void | setBufHandler(SecureNioChannel.ApplicationBufferHandler bufHandler) |
| protected HandshakeStatus | tasks()
Executes all the tasks needed on the same thread. |
| int | write(ByteBuffer src)
Writes a sequence of bytes to this channel from the given buffer.
|
close();
while (isOpen() && !myTimeoutFunction()) Thread.sleep(25);
if ( isOpen() ) close(true); //forces a close if you timed out
Throws: IOException if an I/O error occurs IOException if there is data on the outgoing network buffer and we are unable to flush it
UNKNOWN: Implement this java.io.Closeable method
Parameters: force boolean
Throws: IOException
Returns: boolean
Parameters: buf ByteBuffer
Returns: boolean true if the buffer has been emptied out, false otherwise
Throws: IOException
Parameters: read boolean - true if the underlying channel is readable write boolean - true if the underlying channel is writable
Returns: int - 0 if hand shake is complete, otherwise it returns a SelectionKey interestOps value
Throws: IOException
Parameters: doread boolean
Returns: SSLEngineResult
Throws: IOException
Parameters: doWrite boolean
Returns: SSLEngineResult
Throws: IOException
Parameters: dst The buffer into which bytes are to be transferred
Returns: The number of bytes read, possibly zero, or -1 if the channel has reached end-of-stream
Throws: IOException If some other I/O error occurs IllegalArgumentException if the destination buffer is different than bufHandler.getReadBuffer()
UNKNOWN: Implement this java.nio.channels.ReadableByteChannel method
Returns: HandshakeStatus
Parameters: src The buffer from which bytes are to be retrieved
Returns: The number of bytes written, possibly zero
Throws: IOException If some other I/O error occurs
UNKNOWN: Implement this java.nio.channels.WritableByteChannel method