/** * Encrypt the response and flush it using <code>OutputWriter</code> */ public static void flushChannel(SocketChannel socketChannel, ByteBuffer bb, ByteBuffer outputBB, SSLEngine sslEngine) throws IOException{ 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(); } }
if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) { executeDelegatedTask(sslEngine);
executeDelegatedTask(sslEngine); break; handshakeStatus = executeDelegatedTask(sslEngine);