Code example for PipedInputStream

     * errHandle will appear as if sent by the process to stderr. 
     * @throws IOException 
    public void setUp() throws IOException { 
        PipedInputStream out = new PipedInputStream();
        PipedInputStream err = new PipedInputStream();
        PipedOutputStream in = new PipedOutputStream();
        // handles used in tests to simulate process out/input 
        outHandle = new PipedOutputStream(out);
        errHandle = new PipedOutputStream(err);
        inHandle = new PipedInputStream();
        // create monitor and observers. 
        stdoutObserver = new DummyStreamObserver();
        stderrObserver = new DummyStreamObserver();
        dummyProcess = new DummyProcess(0, out, err, in);
        monitor = new ProcessMonitor(dummyProcess);
Contextual code suggestions in your IDE  Get Codota for Java