Description
A race condition between fakeremote.Start() is spawned as a goroutine to listen for connections, and its caller assumes that the listener will immediately be ready to accept connections. This leads to intermittent test failures if the caller attempts before the fake remote runtime is ready to listen. The code needs to be refactored so that the fake remote returns from listen, and then spawns the server as a goroutine and returns.
This can be reproduced by running the remote_runtime_test in a loop; it fails periodically. Failure can be accelerated by putting a time.Sleep(100010001000) in fake.Start() immediately before the call to util.CreateListener; the failure is then effectively deterministic.
Fix tested by running about 150,000 iterations without observing any failures.