It's because Qt (or rather QSslSocket) closes the connection immediately after emitting the error() signal.