General improvements to MessageHandler

Also, move the PING reponse handler into the Connection while() loop.