When the tunnel is closed and another `connect()` call is made, it stops notifying about state changes (`onstatechanges`) if the connection continues to fail. This patch sets the state to `CONNECTING` when calling `connect()`.
Move `setState()` to Tunnel class to avoid repetition.