public static void main(String args[]) {
        Logger log = Logger.getLogger("MAIN");

        Properties pt = new Properties();
        pt.setProperty("connection.host", "127.0.0.1");
        pt.setProperty("connection.port", "21");
        pt.setProperty("user.login", "kurt");
        pt.setProperty("user.password", "Bez3et4");
        pt.setProperty("connection.type", "FTP_CONNECTION");
        pt.setProperty("connection.timeout", "10000");
        pt.setProperty("connection.passive", "true");

        try {
            FTPConnection connection = FTPConnectionFactory.getInstance(pt);

            try {
                connection.connect();
                FTPFile fromFile = new FTPFile("/tmp", "token.jpg");
                InputStream pis = null;
                FileOutputStream fos = new FileOutputStream("/tmp/download.stream");
                
                pis = connection.downloadStream(fromFile);
                
                int len = -1;
                byte[] buf = new byte[pis.available()];
                while ( (len = pis.read(buf)) != -1 ) {
                    fos.write(buf, 0, len);
                }
                
                pis.close();
                fos.close();
                
                connection.disconnect();
            } catch (NotConnectedException nce) {
                log.error(nce);
                nce.printStackTrace();
            } catch (IOException ioe) {
                log.error(ioe);
                ioe.printStackTrace();
            } catch (Exception e) {
                log.error(e);
                e.printStackTrace();
            }
        } catch (ConfigurationException ce) {
            log.error(ce);
        }
    }