Fixes tests to use the loopback address whenever possible. It also fixes some safe publishing issues, or add diagnostics in some of the tests.
Reviewed-by: michaelm
Makes a few intermittently failing tests more resilient to port reuse issues by ensuring they bind to the loopback address instead of the wildcard.
Reviewed-by: alanb, chegar