Added listener for connection error, such that the user can handle it.

I don't think this is a good solution, but it worked for me.