GIRAPH-1249

closes #145
diff --git a/giraph-core/src/main/java/org/apache/giraph/graph/GraphTaskManager.java b/giraph-core/src/main/java/org/apache/giraph/graph/GraphTaskManager.java
index 280d285..6b94163 100644
--- a/giraph-core/src/main/java/org/apache/giraph/graph/GraphTaskManager.java
+++ b/giraph-core/src/main/java/org/apache/giraph/graph/GraphTaskManager.java
@@ -1161,8 +1161,12 @@
    * @return True if the throwable is a "connection reset by peer",
    * false otherwise.
    */
-  public static boolean isConnectionResetByPeer(Throwable throwable) {
-    return throwable.getMessage().startsWith(
-      "Connection reset by peer") ? true : false;
+  public static boolean isConnectionFailure(Throwable throwable) {
+    String erroMessage = throwable.getMessage().toLowerCase();
+    if (erroMessage.startsWith("connection reset by peer") ||
+      erroMessage.startsWith("connection timed out")) {
+      return true;
+    }
+    return false;
   }
 }
diff --git a/giraph-core/src/main/java/org/apache/giraph/worker/BspServiceWorker.java b/giraph-core/src/main/java/org/apache/giraph/worker/BspServiceWorker.java
index a745b1e..9a8f592 100644
--- a/giraph-core/src/main/java/org/apache/giraph/worker/BspServiceWorker.java
+++ b/giraph-core/src/main/java/org/apache/giraph/worker/BspServiceWorker.java
@@ -121,7 +121,7 @@
 
 import com.google.common.collect.Lists;
 
-import static org.apache.giraph.graph.GraphTaskManager.isConnectionResetByPeer;
+import static org.apache.giraph.graph.GraphTaskManager.isConnectionFailure;
 
 /**
  * ZooKeeper-based implementation of {@link CentralizedServiceWorker}.
@@ -224,7 +224,7 @@
             // If the connection was closed by the client, then we just log
             // the error, we do not fail the job, since the client will
             // attempt to reconnect.
-            return !isConnectionResetByPeer(throwable);
+            return !isConnectionFailure(throwable);
           }
         )
     );