Code example for PipedInputStream

0
	public InputStream in; 
	public PrintStream out; 
 
	public void connect(StreamAdapter adapter) throws IOException { 
		PipedOutputStream pout = new PipedOutputStream(); 
		PipedInputStream pin = new PipedInputStream(pout); 
		PipedOutputStream pout2 = new PipedOutputStream(); 
		PipedInputStream pin2 = new PipedInputStream(pout2); 
		this.in = pin2; 
		this.out = new PrintStream(pout, true); 
		adapter.in = pin; 
		adapter.out =  new PrintStream(pout2, true); 
	} 
/* 
	public class Protocol implements Runnable { 
 
		private PrintStream out; 
		private Thread thread; 
 
		public Protocol(PrintStream out) { 
			this.out = out;