if( log.isDebugEnabled() )
{
log.debug( session + " write outNetBuffer: " +
sslHandler.getOutNetBuffer() );
}
ByteBuffer writeBuffer = copy( sslHandler.getOutNetBuffer() );
if( log.isDebugEnabled() )
{
log.debug( session + " session write: " + writeBuffer );
}
//debug("outNetBuffer (after copy): {0}", sslHandler.getOutNetBuffer());
filterWrite( nextFilter, session, writeBuffer, SSL_MARKER );
// loop while more writes required to complete handshake
while( sslHandler.needToCompleteInitialHandshake() )
{
try
{
sslHandler.continueHandshake( nextFilter );
}
catch( SSLException ssle )
{
SSLException newSSLE = new SSLHandshakeException(
"Initial SSL handshake failed." );
newSSLE.initCause( ssle );
throw newSSLE;
}
if( sslHandler.getOutNetBuffer().hasRemaining() )
{
if( log.isDebugEnabled() )
{
log.debug( session + " write outNetBuffer2: " +
sslHandler.getOutNetBuffer() );
}
ByteBuffer writeBuffer2 = copy( sslHandler
.getOutNetBuffer() );
filterWrite( nextFilter, session, writeBuffer2, SSL_MARKER );
}
}
}