From 2e909a02f1c0ab99e1bcc9a85c2f459663c0b45e Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Wed, 19 Dec 2018 20:41:48 -0500 Subject: [PATCH] Specifying a 5 seconds timeout on both the read and write operations when creating the websocket client --- .../java/cy/agorise/graphenej/api/android/NetworkService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java b/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java index cb44c48..3eaf970 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java @@ -223,6 +223,8 @@ public class NetworkService extends Service { OkHttpClient client = new OkHttpClient .Builder() .connectTimeout(2, TimeUnit.SECONDS) + .readTimeout(5, TimeUnit.SECONDS) + .writeTimeout(5, TimeUnit.SECONDS) .build(); mSelectedNode = nodeProvider.getBestNode(); Log.v(TAG,"connect.url: "+ mSelectedNode.getUrl()+", latency: "+mSelectedNode.getLatencyValue());