public void uploadFiles(final String localDirectory, final Collection<String> filenames) throws IOException {
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    connect();
                    InputStream is;
                    for (String filename : filenames) {
                        is = new FileInputStream(localDirectory + File.separator + filename);
                        client.storeFile(filename, is);
                        is.close();
                    }
                    disconnect();
                } catch (IOException ioe) {
                    throw new RuntimeException(ioe);
                }
            }
        }).start();
    }