Code example for PipedInputStream

Methods: close, connect

0
	public void test_close() throws IOException { 
		// Test for method void java.io.PipedInputStream.close() 
		pis = new PipedInputStream();
		pos = new PipedOutputStream();
        pis.connect(pos);
        pis.close();
		try { 
			pos.write((byte) 127);
            fail("Failed to throw expected exception");
		} catch (IOException e) {
			// The spec for PipedInput saya an exception should be thrown if 
			// a write is attempted to a closed input. The PipedOuput spec 
			// indicates that an exception should be thrown only when the 
			// piped input thread is terminated without closing 
			return; 
		} 
	} 
 
	/** 
	 * @tests java.io.PipedInputStream#connect(java.io.PipedOutputStream) 
	 */