[jboss-cvs] JBossAS SVN: r109700 - branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Dec 3 06:29:14 EST 2010
Author: mlinhard
Date: 2010-12-03 06:29:13 -0500 (Fri, 03 Dec 2010)
New Revision: 109700
Modified:
branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test/MemcachedSession.java
Log:
timeout produces junit failure rather than error
Modified: branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test/MemcachedSession.java
===================================================================
--- branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test/MemcachedSession.java 2010-12-03 11:22:32 UTC (rev 109699)
+++ branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test/MemcachedSession.java 2010-12-03 11:29:13 UTC (rev 109700)
@@ -28,10 +28,13 @@
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.Socket;
+import java.net.SocketTimeoutException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
+import junit.framework.Assert;
+
/**
* A Really simple Memcached client/helper.
*
@@ -57,14 +60,24 @@
}
public byte[] read(int len) throws IOException {
- byte[] ret = new byte[len];
- input.read(ret, 0, len);
- return ret;
+ try {
+ byte[] ret = new byte[len];
+ input.read(ret, 0, len);
+ return ret;
+ } catch (SocketTimeoutException ste) {
+ Assert.fail("Read timeout");
+ return null;
+ }
}
public byte read() throws IOException {
- input.read(TEMP, 0, 1);
- return TEMP[0];
+ try {
+ input.read(TEMP, 0, 1);
+ return TEMP[0];
+ } catch (SocketTimeoutException ste) {
+ Assert.fail("Read timeout");
+ return -1;
+ }
}
public String readln() throws IOException {
More information about the jboss-cvs-commits
mailing list