尝试使用FTP
连接到FTP服务器(“TLS”,隐式)时出错FTPSClient ftps = new FTPSClient("TLS");
ftps.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out)));
int reply;
try {
ftps.connect("server");
} catch (IOException ex) {
Logger.getLogger(Ftpimport.class.getName()).log(Level.SEVERE, null, ex);
}
reply = ftps.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
try {
ftps.disconnect();
} catch (IOException ex) {
Logger.getLogger(Ftpimport.class.getName()).log(Level.SEVERE, null, ex);
}
throw new Exception("Exception in connecting to FTPs Server");
}
ftps.execPBSZ(0);
ftps.execPROT("P");
ftps.login("user", "pass");
ftps.setFileType(FTP.BINARY_FILE_TYPE);
ftps.enterLocalPassiveMode();
它坚持“234 AUTH命令确定。期待TLS协商。”尝试使用SSLContext,TrustManager总是一样..