Break out onConnect listeners to avoid exception.

Try this.
When I run it it doesn't connect... but it doesn't crash either.