Fix test suite compilation with network 2.6

(cherry picked from commit 5ff933435b16c4224f1ede35fd452cc3933d0408)
Make test suite network dependencies more robust

(cherry picked from commit 5b367e51e8178dd3f208b0dbe6b998b42f61dfc0)