code: private FTPClient createFTPConnection(GlobusURL ftpURL, boolean srcSide)
          throws Exception {
  
          String protocol = ftpURL.getProtocol();
  
          if (protocol.equalsIgnoreCase("ftp")) {
  
              FTPClient ftp = new FTPClient(ftpURL.getHost(),
                                            ftpURL.getPort());
              ftp.authorize(ftpURL.getUser(),
                            ftpURL.getPwd());
  
              return ftp;
  
          } else {
  
              GridFTPClient ftp = new GridFTPClient(ftpURL.getHost(),
                                                    ftpURL.getPort());
  
              if (srcSide) {
                  Authorization auth = getSourceAuthorization();
                  if (auth == null) {
                      auth = HostAuthorization.getInstance();
                  }
                  ftp.setAuthorization(auth);
                  ftp.authenticate(getSourceCredentials());
              } else {
                  Authorization auth = getDestinationAuthorization();
                  if (auth == null) {
                      auth = HostAuthorization.getInstance();
                  }
                  ftp.setAuthorization(auth);
                  ftp.authenticate(getDestinationCredentials());
              }
  
              if (tcpBufferSize != 0) {
                  ftp.setTCPBufferSize(tcpBufferSize);
              }
  
              return ftp;
          }
      }
docs: Creates ftp connection based on the ftp url (secure vs. unsecure)