moved client connection loop in server to run() method