I think there’s potential for a race condition between when you close the Listener and the http server spins up on the no longer reserved port that we’ve seen with lots of tests being run in parallel. You can return the listener, use t.Cleanup to close it and serve your web server on it.