Fix issue #162: Auto-reconnect upon error or disconnection

I tested this by setting the hostname to a local netcat server (nc -l 5222). I responded with erroneous messages and also left the server down to see if the adapter would attempt to reconnect to the server.