Fix #140

Send the authentication message after the socket has fully opened.