Make networkport_test more robust