Don't reconnect on protocol errors

Note that this patch makes test_security_null, test_security_plain and test_security_curve tests block.