setSocketFactory(new FTPSSocketFactory(context)); setServerSocketFactory(new FTPSServerSocketFactory(context)); initSslContext();
/** * PROT command.</br> * C - Clear</br> * S - Safe(SSL protocol only)</br> * E - Confidential(SSL protocol only)</br> * P - Private * @param prot Data Channel Protection Level. * @throws SSLException If it server reply code not equal "200". * @throws IOException If an I/O error occurs while either sending * the command. */ public void execPROT(String prot) throws SSLException, IOException { if (prot == null) prot = DEFAULT_PROT; if (!checkPROTValue(prot)) throw new IllegalArgumentException(); if (FTPReply.COMMAND_OK != sendCommand( FTPSCommand._commands[FTPSCommand.PROT], prot)) throw new SSLException(getReplyString()); if (DEFAULT_PROT.equals(prot)) { setSocketFactory(null); setServerSocketFactory(null); } else { setSocketFactory(new FTPSSocketFactory(context)); initSslContext(); SSLServerSocketFactory ssf = context.getServerSocketFactory(); setServerSocketFactory(ssf); } }