This test flakes about 1% of the time on my device. This is due to the test calling expectNetworkRejectNonSecureVpn() before the handler thread has processed the call to setAlwaysOnVpnPackage. Fix this by waiting for callbacks where it is possible to do so, and by calling waitForIdle where it is not. Test: test-only change Change-Id: Ic5750d4fdf9e7e3654a2b6ade74da6bc5de18fb6