Handling stream errors
Refactored SASL and STARTTLS