Scalatest executes test suites in parallel (but tests within a suite sequentially). That means that `NetworkTestUtils` are going to be used concurrently. Unfortunately there is a race condition in that case as the port can be probed successfully by two concurrent invocations of `NetworkTestUtils` and hence make tests fail. So, we should move to a thread safe mechanism.

Regarding the use of the companion object for providing a default singleton instance of a class as it is the case of `TcpPortAllocator`, it is not unusual nor misleading once you learned the pattern. I've seen several examples on different Scala frameworks doing exactly this. I can find the sources when github stop misbehaving.