Code example for PipedOutputStream

Methods: writeclose

0
	} 
 
	@Test 
	public void testTimeout_readByte_Success2() throws IOException { 
		final byte[] exp = new byte[] { 'a', 'b', 'c' };
		out.write(exp);
		assertEquals(exp[0], is.read());
		assertEquals(exp[1], is.read());
		assertEquals(exp[2], is.read());
		out.close();
		assertEquals(-1, is.read());
	} 
 
	@Test 
	public void testTimeout_readByte_Timeout() throws IOException { 
		beginRead(); 
		try { 
			is.read();
			fail("incorrectly read a byte"); 
		} catch (InterruptedIOException e) {
			// expected