The topic How to use FTPS (introduction) describes the FTPS features of SSLFTPClient. This topic demonstrates the use of FTPS without server validation. Server validation should always be used in a production environment, but disabling it is a good way of getting started.
Using FTPS without server validation is shown in the example below:
ftp.setValidateServer(false); ftp.connect(); ftp.auth(SSLFTPClient.AUTH_TLS);
The first line disables server validation, the second line connects to the server, and the third line switches to TLS (secure mode).
After this, all that is required is to login as normal:
Now it can be treated as an ordinary FTP client, i.e. all the normal FTP operations of FTPClient (which are inherited by SSLFTPClient) can be performed.
Note: Some FTPS servers don't fully comply with the relevant standards, and in particular don't close SSL connections correctly. If you are experiencing hangs on the completion of data transfers, or problems when the connection is closed, try using the DISABLE_SSL_CLOSURE configuration flag before connecting, as shown below: