Read and decrypt bytes from the underlying SSL connections. All
the SSLEngine operations are delegated to class SSLUtils
.
byteBuffer.compact();
int initialPosition = byteBuffer.position();
int byteRead = 0;
while (byteBuffer.position() == initialPosition){
byteRead += SSLUtils.doRead(key,inputBB,sslEngine,readTimeout);
if (byteRead > 0) {
try{
byteBuffer = SSLUtils.unwrapAll(byteBuffer,inputBB,sslEngine);
} catch (IOException ex){
Logger logger = SSLSelectorThread.logger();
if ( logger.isLoggable(Level.FINE) )
logger.log(Level.FINE,"SSLUtils.unwrapAll",ex);
return -1;
}
} else {
break;
}
}
byteBuffer.flip();
return byteRead;