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:
Properties props = System.getProperties();
props.put("ftp.proxySet", "true");
// dummy details
props.put("ftp.proxyHost", "proxy.example.server");
props.put("ftp.proxyPort", "8080");
Creating a connection raises a UnknownHostException which I'm pretty sure means the connection isn't making it past the proxy.
How can user credentials be passed through to the proxy with this connection type.
BTW, I can successfully create a URLConnection through the same proxy using the following; is there an equivalent for the Apache FTPClient?
conn = url.openConnection();
String password = "username:password";
String encodedPassword = new String(Base64.encodeBase64(password.getBytes()));
conn.setRequestProperty("Proxy-Authorization", encodedPassword);