Proxy main loop.