out=resizeApplicationBuffer(out);// guarantees enough room for unwrap
tlsEngineResult=tlsEngine.unwrap(net,out);
try{
tlsEngineResult=tlsEngine.unwrap(net,out);
}catch(SSLExceptione){
if(e.getMessage().startsWith("Unsupported record version Unknown-")){
thrownewSSLException("We appear to have received plain text data where we expected encrypted data. A common cause for this is a peer sending us a plain-text error message when it shouldn't send a message, but close the socket instead).",e);