title: python suds and socksipy
body: <p>I have a little problem using suds with socks.</p>
  
  <p>I have a SSH tunnel ( ssh -vD 9999 user@server),
  and I must send/retrieve data using suds into the tunnel.</p>
  
  <p>So here is my code :</p>
  
  <pre><code>from suds.client import Client
  import socks
  import urllib2
  
  old = urllib2.socket.socket
  socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9999)
  socks.wrapmodule(urllib2)# Suds use urllib2
  client = Client(wsdl)
  </code></pre>
  
  <p>But it's not working, I get from the .py :</p>
  
  <pre><code>socks.GeneralProxyError: (0, 'connection closed unexpectedly')
  </code></pre>
  
  <p>And from my SSH tunnel :</p>
  
  <pre><code>debug1: Connection to port 9999 forwarding to socks port 0 requested.
  debug1: channel 2: new [dynamic-tcpip]
  channel 2: open failed: connect failed: Connection refused
  debug1: channel 2: free: direct-tcpip: listening port 9999 for 127.0.0.1 port 3000, connect from 127.0.0.1 port 42219, nchannels 3
  </code></pre>
  
  <p>But if instead of instantiate Client, I do juste an urllib2.urlopen('google.fr'), it's working.</p>
  
  <p>So I don't know what I do wrong.</p>
  
  <p>If you have an idea,</p>
  
  <p>Thanks</p>