title: FTP connection through proxy with Java
body: <p>I'm trying to connect to an FTP server through a proxy using org.apache.commons.net.ftp.FTPClient. Pretty sure the system properties are getting set correctly as per following:</p>
  
  <pre><code>Properties props = System.getProperties();
  props.put("ftp.proxySet", "true");
  // dummy details
  props.put("ftp.proxyHost", "proxy.example.server");
  props.put("ftp.proxyPort", "8080");
  </code></pre>
  
  <p>Creating a connection raises a UnknownHostException which I'm pretty sure means the connection isn't making it past the proxy. </p>
  
  <p>How can user credentials be passed through to the proxy with this connection type.</p>
  
  <p>BTW, I can successfully create a URLConnection through the same proxy using the following; is there an equivalent for the Apache FTPClient?</p>
  
  <pre><code>conn = url.openConnection();
  String password = "username:password";
  String encodedPassword = new String(Base64.encodeBase64(password.getBytes()));
  conn.setRequestProperty("Proxy-Authorization", encodedPassword);
  </code></pre>