Apply behaviors before first connection attempt

Allows 'connect_timeout' to take effect already on the first
connection.
Fix issues in PR #148
Merge branch 'melor-pre_connect_behaviors'
Merge remote-tracking branch 'origin/master'