title: Error during SSL Handshake with qt
body: <p>I came to you today because I've got a problem with my Client+Server app. I built a server and client app which were working fine with QTcpSocket but I thought about adding some security and going for QSslSocket <strong>with delayed handshake</strong>. The problem is that my client is acting really weirdly. Here is the situation :</p>
  
  <ul>
  <li>If I use <code>connectToHostEncrypted()</code> in my Client and call <code>startServerEncryption()</code> just after geting the socket in my incomingConnection slot it works fine.</li>
  <li>But if I delay the handshake (by doing some read/write in the socket) and call later <code>startServerEncryption()</code>, I got the error : <code>Error during SSL handshake: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number</code> on server side. I've also tried to use <code>startClientEncryption()</code> on client side but I get the same error.</li>
  </ul>
  
  <p>The certificate is self-signed and loaded and applied to the socket correctly on server (I checked by testing the first situation with openssl s_client and the server accept all the protocol that I can test with (SSLv3, TLSv1, TLSv1.1, TLSv1.2).I cannot test with SSLv2 : on the Client, using this protocol with <code>QSslSocket::setProtocol(QSsl::SslV2)</code> show the error <code>unsupported protocol</code> and openssl s_client won't connect with the -ssl2 argument, it just show the available arguments.</p>
  
  <p>I'm using Qt 5.9.1 and I've installed OpenSSL-Win32 v1.0.2L to get the dlls. I'm also compiling with msvc2015 32bit on Windows 7 64bit.
  I hope that you can help me (and sorry for my bad english), Nicolas.</p>