Fix issue in Xmpp state machine that impacts tests

Increment XmppConnection flap count after setting state to IDLE
or ACTIVE.

Incrementing the flap count prior to udpating the state sometimes
causes issues for tests that first wait for the flap count to go
up and then wait for the state to reach ESTABLISHED again.  They
may see the updated flap count and old state and hence eventually
fail.

Tweak tests to verify flap counts on both server and client side.

Change-Id: I92d90b8ab7b4c83ce64080897f470ce325f8b988
Merge "Fix issue in Xmpp state machine that impacts tests"