List of usage examples for org.apache.commons.net.ftp FTPSSocketFactory FTPSSocketFactory
public FTPSSocketFactory(SSLContext context)
From source file:org.apache.ftpserver.ssl.MinaImplicitDataChannelTest.java
private void secureClientDataConnection() throws NoSuchAlgorithmException, KeyManagementException { // FTPSClient does not support implicit data connections, so we hack it ourselves FTPSClient sclient = (FTPSClient) client; SSLContext context = SSLContext.getInstance("TLS"); // these are the same key and trust managers that we initialize the client with context.init(new KeyManager[] { clientKeyManager }, new TrustManager[] { clientTrustManager }, null); sclient.setSocketFactory(new FTPSSocketFactory(context)); SSLServerSocketFactory ssf = context.getServerSocketFactory(); sclient.setServerSocketFactory(ssf); // FTPClient should not use SSL secured sockets for the data connection }