Process () { // have to be synchronised because used from pooled thread ByteArrayOutputStream outputStream = new ByteArrayOutputStream(10000); Semaphore finished = new Semaphore(1); return new Process() { @Override public OutputStream getOutputStream() { return outputStream; } @Override public InputStream getInputStream() { return new ByteArrayInputStream(new byte[0]); } @Override public InputStream getErrorStream() { return new ByteArrayInputStream(new byte[0]); } @Override public int waitFor() { finished.waitFor(); return 0; } @Override public int exitValue() { return 0; } @Override public void destroy() { finished.up(); } }; }