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