code: public static void main(String[] args) {
          try {
              if (args.length == 5 || args.length == 6) {
                  String protocol = args[0];
                  int port = Integer.parseInt(args[1]);
                  String user = args[2];
                  String password = args[3];
                  String fileName = args[4];
  
                  String context = Constants.FEDORA_DEFAULT_APP_CONTEXT;
  
                  if (args.length == 6 && !args[5].isEmpty()) {
                      context = args[5];
                  }
  
                  Uploader uploader =
                          new Uploader(protocol, port, context, user, password);
                  File f = new File(fileName);
                  System.out.println(uploader.upload(new FileInputStream(f)));
                  System.out.println(uploader.upload(f));
                  uploader =
                          new Uploader(protocol,
                                       port,
                                       context,
                                       user + "test",
                                       password);
                  System.out.println(uploader.upload(f));
              } else {
                  System.err
                          .println("Usage: Uploader host port user password file [context]");
              }
          } catch (Exception e) {
              System.err.println("ERROR: " + e.getMessage());
          }
      }
docs: Test this class by uploading the given file three times. First, with the
  provided credentials, as an InputStream. Second, with the provided
  credentials, as a File. Third, with bogus credentials, as a File.