Code example for PipedInputStream

0
	private long start;
 
	@Before 
	public void setUp() throws Exception { 
		out = new PipedOutputStream();
		in = new PipedInputStream(out);
		timer = new InterruptTimer();
		is = new TimeoutInputStream(in, timer);
		is.setTimeout(timeout);
	} 
 
	@After 
	public void tearDown() throws Exception { 
		timer.terminate();
		for (Thread t : active())
			assertFalse(t instanceof InterruptTimer.AlarmThread);
	} 
 
	@Test 
	public void testTimeout_readByte_Success1() throws IOException { 
		out.write('a');