SessionLog.debug(session, " session write: " + writeBuffer);
}
//debug("outNetBuffer (after copy): {0}", sslHandler.getOutNetBuffer());
writeFuture = new DefaultWriteFuture(session);
parent.filterWrite(nextFilter, session, new WriteRequest(
writeBuffer, writeFuture));
// loop while more writes required to complete handshake
while (needToCompleteInitialHandshake()) {
try {
handshake(nextFilter);
} catch (SSLException ssle) {
SSLException newSSLE = new SSLHandshakeException(
"Initial SSL handshake failed.");
newSSLE.initCause(ssle);
throw newSSLE;
}
if (getOutNetBuffer().hasRemaining()) {
if (SessionLog.isDebugEnabled(session)) {
SessionLog.debug(session, " write outNetBuffer2: "
+ getOutNetBuffer());
}
org.apache.mina.common.ByteBuffer writeBuffer2 = copy(getOutNetBuffer());
writeFuture = new DefaultWriteFuture(session);
parent.filterWrite(nextFilter, session, new WriteRequest(
writeBuffer2, writeFuture));
}
}
} finally {
writingEncryptedData = false;