Fix the test case so that it passes in the same filter
The connecting flag should be set to false initially
Set up the connected handler before connect
Revert "Fix the test case so that it passes in the same filter"

This reverts commit 7538601b79a99db55fc8b420f0ea78bee0ef78de.
Only call the orginal method once
Merge pull request #270 from raymondfeng/master

Fix connect() related issues