Note that the test may suffer from issues caused by asynchronicity:
ws2 may be opened before ws is.
I was trying to fix it in the branch. But even with the similar patch, the test passes/fails ocasionally.