package com.itjob.javaadvanced;

import java.io.IOException;

/**
 * 第3章 Java的高级特性考题
 * 使用管道流进行编程实例：管道输出流发送消息“Hello! Amigo.”，管道输入流接收到信息后打印出来
 * 管道流测试类
 * @author AmigoXie
 */
public class PipeTest {
    public static void main(String[] args) {
        PipeSender sender = new PipeSender(); 
        PipeReceiver receiver = new PipeReceiver(); 
        try { 
            // 连接管道 
        	sender.getPos().connect(receiver.getPis()); 
        } catch (IOException e) { 
            e.printStackTrace(); 
        }
        
        // 启动线程 
        new Thread(sender).start(); 
        new Thread(receiver).start();
    } 
}
