Catch AttributeError in client connected check

If the client has never connected, there will be no __transport attribute.
Merge pull request #3 from leth/patch-3

Catch AttributeError in client connected check