/**
* @tests java.io.PipedWriter#write(int)
*/
public void test_write_I_MultiThread() throws IOException {
final PipedReader pr = new PipedReader();
final PipedWriter pw = new PipedWriter();
// test if writer recognizes dead reader
pr.connect(pw);
class WriteRunnable implements Runnable {
boolean pass = false;
boolean readerAlive = true;
public void run() {
try {
pw.write(1);
while (readerAlive) {
// wait the reader thread dead
}
try {
// should throw exception since reader thread
// is now dead
pw.write(1);
} catch (IOException e) {
pass = true;
}
} catch (IOException e) {
//ignore