Emit reconnect event, plus basic tests

Should address issues #582, #627.

Resolution to getting reconnect to emit could alternatively be solved by getting socket.open() to call the callback regardless of error, as suggested in pull request #635.