title: Twisted proxy for proxies
body: <p>I have list of proxies.</p>
  
  <p>I want to write server (based on Twisted) which can connect user to random proxy from my list. So for example i have these list of proxies:</p>
  
  <pre><code>187.17.19.156:48111
  201.173.81.110:43542
  183.245.147.14:80
  183.245.147.138:80
  93.174.55.82:8080
  </code></pre>
  
  <p>My server IP is 55.55.55.55:1234
  When user using my server as proxy than my server will redirect any traffic to one of the proxy from list.</p>
  
  <p>Right now i'm ending up with code like that. But cant get response back and cant switching proxies dynamic.</p>
  
  <pre><code>from twisted.internet.protocol import Protocol, Factory
  from twisted.internet.endpoints import TCP4ClientEndpoint
  from twisted.internet import reactor
  
  
  class ServerProtocol(Protocol):
  
      def dataReceived(self,data):
          print("REquest" + str(data))
  
          def clientProtocol():
              return ClientProtocol(data)
          endpoint = TCP4ClientEndpoint(reactor, "127.0.0.1", 80)
          endpoint.connect(Factory.forProtocol(clientProtocol))
  
  
  class ClientProtocol(Protocol):
      def __init__(self, dataToSend):
          self.dataToSend = dataToSend
  
      def connectionMade(self):
          self.transport.write(self.dataToSend)
  
      def dataReceived(self,data):
          print("Reply" + str(data))
  
  reactor.listenTCP(3333,
                    Factory.forProtocol(ServerProtocol))
  reactor.run()
  </code></pre>
  
  <p>Does it even possible to implement?</p>