Catch AttributeError in client connected check

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

Catch AttributeError in client connected check