How proxy server act as client and server?