@Override
    public void send(final String command, final ProgressListener listener, final TranscriptListener transcript) throws BackgroundException {
        if(log.isDebugEnabled()) {
            log.debug(String.format("Send command %s", command));
        }
        final Session sess;
        try {
            sess = session.getClient().startSession();
        }
        catch(IOException e) {
            throw new SFTPExceptionMappingService().map(e);
        }
        try {
            listener.message(command);
            final Session.Command exec = sess.exec(command);

            final BufferedReader stdoutReader = new BufferedReader(
                    new InputStreamReader(new StreamGobbler(exec.getInputStream()), Charset.forName(session.getHost().getEncoding())));
            final BufferedReader stderrReader = new BufferedReader(
                    new InputStreamReader(new StreamGobbler(exec.getErrorStream()), Charset.forName(session.getHost().getEncoding())));

            try {
                // Here is the output from stdout
                while(true) {
                    final String line = stdoutReader.readLine();
                    if(null == line) {
                        break;
                    }
                    transcript.log(TranscriptListener.Type.response, line);
                }
                // Here is the output from stderr
                final StringBuilder error = new StringBuilder();
                while(true) {
                    String line = stderrReader.readLine();
                    if(null == line) {
                        break;
                    }
                    transcript.log(TranscriptListener.Type.response, line);
                    // Standard error output contains all status messages, not only errors.
                    if(StringUtils.isNotBlank(error.toString())) {
                        error.append(" ");
                    }
                    error.append(line).append(".");
                }
                if(StringUtils.isNotBlank(error.toString())) {
                    throw new InteroperabilityException(error.toString());
                }
                else {
                    if(log.isInfoEnabled()) {
                        log.info(String.format("Command %s returned no errors", command));
                    }
                }
            }
            finally {
                IOUtils.closeQuietly(stdoutReader);
                IOUtils.closeQuietly(stderrReader);
            }
        }
        catch(IOException e) {
            throw new DefaultIOExceptionMappingService().map(e);
        }
    }
@Test
    @Ignore
    public void testSend() throws Exception {
        final StringBuilder t = new StringBuilder();
        new SFTPCommandFeature(session).send("ps", new ProgressListener() {
            @Override
            public void message(final String message) {
                assertEquals("ps", message);
            }
        }, new TranscriptListener() {
            @Override
            public void log(final Type request, final String message) {
                switch(request) {
                    case response:
                        t.append(message);
                }
            }
        });
        assertTrue("PID TTY          TIME CMD22417 ?        00:00:00 sshd22418 ?        00:00:00 sftp-server22427 ?        00:00:00 ps", t.toString().startsWith(
            "  PID TTY          TIME"));

    }