Thanks for answer but I want to clarify the task:
I need to create a proxy server which listen incoming connections (like http or socks proxy) and forwards them to another proxy (http or socks).
This is the case that you have answered?