[test] Improved test for the async forEach to correcly iterate and count connections