refactor all the code into proxyserver and proxyserverclient