Commit 5ce70bc3 authored by Matija Obreza's avatar Matija Obreza
Browse files

Merge branch '15-ftp-tests-fail-at-ssl' into 'master'

Resolve "FTP tests fail at SSL"

Closes #15

See merge request !10
parents f1acff0e 7eb726be
......@@ -23,9 +23,13 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.SocketException;
import java.security.cert.X509Certificate;
import java.util.Arrays;
import java.util.stream.Collectors;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPReply;
......@@ -66,8 +70,25 @@ public class FtpServerTest {
// create an implicit FTPS client
private FTPClient createFtpClient() {
final FTPClient ftp = new FTPSClient(true);
final FTPSClient ftp = new FTPSClient(true);
ftp.setConnectTimeout(2000);
TrustManager trustAllCerts = new X509TrustManager() {
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
@Override
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
@Override
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
};
ftp.setTrustManager(trustAllCerts);
return ftp;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment