客户端连服务端,服务端在客户端连接成功后 把连接关闭。客户端依然在不停的read。没抛异常。这个时候应该抛异常呀。。客户端代码 
 public static void main(String[] args) throws InterruptedException  {
    String hostname = "localhost";       
    Socket connection = null;  
    byte[] receiveBuffer = new byte[2*1024];     
    while(true){
   try {
connection = new Socket(hostname, 1111);
InputStream input = connection.getInputStream();

int count = 0;
while(count<10)
{
System.out.println(new Timestamp(System.currentTimeMillis()));
Thread.sleep(100);
count++;
 int bytesRead = input.read(receiveBuffer, 0, 2*1024);
 System.out.println(bytesRead);
}   
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}    
    }

 }
服务端代码
public static void main(String[] args) { try {
ServerSocket server = new ServerSocket(1111);
while (true) {
Socket connection = server.accept();
System.out.println("Accepting connections on port "
+ connection.getLocalPort());
System.out.println("Accepting connections remote port "
+ connection.getPort());
if (connection != null)
{
System.out.println(new Timestamp(System.currentTimeMillis()));
connection.close();
}
}      

} // end try catch (IOException ex) { System.err.println(ex); }