Change the reconnect logic to gracefully handle the server going away and
coming back.
Merge pull request #39 from borismus/reconnect_fix

Change the reconnect logic to gracefully handle the server going away