diff test/channeltest/testSeMa.java @ 268:b69d22dbc6f1

*** empty log message ***
author kono
date Thu, 11 Sep 2008 15:00:16 +0900
parents e72e0eae1261
children d6a33e295d47
line wrap: on
line diff
--- a/test/channeltest/testSeMa.java	Thu Sep 11 14:39:32 2008 +0900
+++ b/test/channeltest/testSeMa.java	Thu Sep 11 15:00:16 2008 +0900
@@ -70,12 +70,17 @@
 						ns.writeLog("accepts a client.", 1);
 
 					}else if(key.isReadable()){
-						REPSocketChannel<String> channel = (REPSocketChannel<String>) key.channel(pack);
-						String packet;
-						packet = channel.read();
-						if (packet==null) continue;
-						ns.writeLog("receives String==> `"+packet+"\'", 1);
-						channel.write(this.getName()+": get `"+packet+"\'");
+						try {
+							REPSocketChannel<String> channel = (REPSocketChannel<String>) key.channel(pack);
+							String packet;
+							packet = channel.read();
+							if (packet==null) continue;
+							ns.writeLog("receives String==> `"+packet+"\'", 1);
+							channel.write(this.getName()+": get `"+packet+"\'");
+						}catch (IOException e) { 
+							ns.writeLog("channel "+ns+"closed.");
+							key.cancel();
+						}
 					}
 				}
 			}