client thread works, but main thread need to wait for it