wait for server to be running instead of naive sleep.