Fix cronet unit test for TrafficStats cache mechanism

Currently, there is a rate-limit on TrafficStats getter APIs to
reduce the need of accessing bpf map. For any caller who calls
this method within 1 second, a stale result will be returned.

One expected outcome is this change would break any test which
relies on immediate change of the result of TrafficStats after
making network traffic. Thus, related tests are needed to be
fixed accordingly.

This change do retries when getting readings from TrafficStats,
to add tolerance of not getting immediate change of TrafficStats.
Up to 1 second delay to complete the affected tests are expected.

Test: atest net_unittests_tester
Bug: 339154075
Change-Id: I76c0c1da66376bc4db614eb5443e0b6f7618a53b
1 file changed