SSLOutputWriterpublic final class SSLOutputWriter extends Object SSL over NIO utility to encrypt ByteBuffer and flush them.
All the SSLEngine operations are delegated to class SSLUtils |
Methods Summary |
---|
public static void | flushChannel(java.nio.channels.SocketChannel socketChannel, java.nio.ByteBuffer bb)Encrypt the response and flush it using OutputWriter
SSLWorkerThread workerThread = (SSLWorkerThread)Thread.currentThread();
SSLEngine sslEngine = workerThread.getSSLEngine();
ByteBuffer outputBB = workerThread.getOutputBB();
flushChannel(socketChannel,bb,outputBB,sslEngine);
| public static void | flushChannel(java.nio.channels.SocketChannel socketChannel, java.nio.ByteBuffer bb, java.nio.ByteBuffer outputBB, javax.net.ssl.SSLEngine sslEngine)Encrypt the response and flush it using OutputWriter
while (bb.hasRemaining()) {
SSLEngineResult result = SSLUtils.wrap(bb,outputBB,sslEngine);
switch (result.getStatus()) {
case OK:
if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
SSLUtils.executeDelegatedTask(sslEngine);
}
break;
default:
throw new IOException("SSLOutputWriter: " + result.getStatus());
}
if (outputBB.hasRemaining()) {
OutputWriter.flushChannel(socketChannel,outputBB);
}
}
outputBB.clear();
|
|