I think I found a better way. If we move the closing of client sockets and the closing of the server socket into the destructor of TCPServer then we are guaranteed that they are destroyed after the thread is joined as the destructor for the fixture requires that the thread join before calling delete on _server:

```cpp
_server->stop();
_thread->join();

delete _thread;
delete _server; // refered to server must outlive thread
```