fix connected property

set connected property in on_connect callback based on the return code
value.

fixes #8