The proxy server is, above all, a security device.
The proxy will accept the connection and then attempt to proxy it on.
Clients need not be aware of the existence of the proxy.
The complete example I used the code from is Proxy server - Wikipedia, the free encyclopedia
I am doing wrong