private FTPClient createClient() throws FileSystemException {
    final GenericFileName rootName = getRoot();

    UserAuthenticationData authData = null;
    try {
      authData =
          UserAuthenticatorUtils.authenticate(
              fileSystemOptions, FtpFileProvider.AUTHENTICATOR_TYPES);

      return FtpClientFactory.createConnection(
          rootName.getHostName(),
          rootName.getPort(),
          UserAuthenticatorUtils.getData(
              authData,
              UserAuthenticationData.USERNAME,
              UserAuthenticatorUtils.toChar(rootName.getUserName())),
          UserAuthenticatorUtils.getData(
              authData,
              UserAuthenticationData.PASSWORD,
              UserAuthenticatorUtils.toChar(rootName.getPassword())),
          rootName.getPath(),
          getFileSystemOptions());
    } finally {
      UserAuthenticatorUtils.cleanup(authData);
    }
  }
  /** Creates a {@link FileSystem}. */
  protected FileSystem doCreateFileSystem(
      final FileName name, final FileSystemOptions fileSystemOptions) throws FileSystemException {
    // Create the file system
    final GenericFileName rootName = (GenericFileName) name;
    FileSystemOptions fsOpts =
        (fileSystemOptions == null) ? new FileSystemOptions() : fileSystemOptions;

    UserAuthenticationData authData = null;
    HttpClient httpClient;
    try {
      authData = UserAuthenticatorUtils.authenticate(fsOpts, AUTHENTICATOR_TYPES);

      httpClient =
          HttpClientFactory.createConnection(
              WebdavFileSystemConfigBuilder.getInstance(),
              "http",
              rootName.getHostName(),
              rootName.getPort(),
              UserAuthenticatorUtils.toString(
                  UserAuthenticatorUtils.getData(
                      authData,
                      UserAuthenticationData.USERNAME,
                      UserAuthenticatorUtils.toChar(rootName.getUserName()))),
              UserAuthenticatorUtils.toString(
                  UserAuthenticatorUtils.getData(
                      authData,
                      UserAuthenticationData.PASSWORD,
                      UserAuthenticatorUtils.toChar(rootName.getPassword()))),
              fsOpts);
    } finally {
      UserAuthenticatorUtils.cleanup(authData);
    }

    return new WebdavFileSystem(rootName, httpClient, fsOpts);
  }