move server to thread