Lots of work on authentication, handshake and initial socket connection