move thread sleep to fix 100% CPU tight loop

The thread sleep command was put in the wrong place causing this
the simulated server thread not to sleep but rather to go into
100% CPU usage.