aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKoushik Dutta <koushd@gmail.com>2013-05-20 22:23:19 -0700
committerKoushik Dutta <koushd@gmail.com>2013-05-20 22:23:19 -0700
commitb5533915b107ef669c782ff7b485fdf70fec75c6 (patch)
treebf8a4ca1be493cfcc7f57b33808989a3fbd7aec2
parent96f890074d576101b3bde261f747962c0e70ec79 (diff)
downloadAndroidAsync-b5533915b107ef669c782ff7b485fdf70fec75c6.tar.gz
AndroidAsync-b5533915b107ef669c782ff7b485fdf70fec75c6.tar.bz2
AndroidAsync-b5533915b107ef669c782ff7b485fdf70fec75c6.zip
Revert "change resultcallback interface"
This reverts commit f5f6432759b511c724d9ec82646729be0e1b9d46.
-rw-r--r--AndroidAsync/src/com/koushikdutta/async/callback/ResultCallback.java2
-rw-r--r--AndroidAsync/src/com/koushikdutta/async/http/AsyncHttpClient.java4
-rw-r--r--AndroidAsync/src/com/koushikdutta/async/http/SocketIOClient.java2
-rw-r--r--AndroidAsyncTest/src/com/koushikdutta/async/test/SocketIOTests.java77
4 files changed, 34 insertions, 51 deletions
diff --git a/AndroidAsync/src/com/koushikdutta/async/callback/ResultCallback.java b/AndroidAsync/src/com/koushikdutta/async/callback/ResultCallback.java
index e059994..9c41780 100644
--- a/AndroidAsync/src/com/koushikdutta/async/callback/ResultCallback.java
+++ b/AndroidAsync/src/com/koushikdutta/async/callback/ResultCallback.java
@@ -1,5 +1,5 @@
package com.koushikdutta.async.callback;
public interface ResultCallback<S, T> {
- public void onCompleted(Exception e, T result);
+ public void onCompleted(Exception e, S source, T result);
}
diff --git a/AndroidAsync/src/com/koushikdutta/async/http/AsyncHttpClient.java b/AndroidAsync/src/com/koushikdutta/async/http/AsyncHttpClient.java
index e0587d2..98e5915 100644
--- a/AndroidAsync/src/com/koushikdutta/async/http/AsyncHttpClient.java
+++ b/AndroidAsync/src/com/koushikdutta/async/http/AsyncHttpClient.java
@@ -312,7 +312,7 @@ public class AsyncHttpClient {
mServer.post(new Runnable() {
@Override
public void run() {
- callback.onCompleted(e, result);
+ callback.onCompleted(e, response, result);
}
});
return;
@@ -320,7 +320,7 @@ public class AsyncHttpClient {
AsyncServer.post(handler, new Runnable() {
@Override
public void run() {
- callback.onCompleted(e, result);
+ callback.onCompleted(e, response, result);
}
});
}
diff --git a/AndroidAsync/src/com/koushikdutta/async/http/SocketIOClient.java b/AndroidAsync/src/com/koushikdutta/async/http/SocketIOClient.java
index 9bbdbcc..3ef0d2f 100644
--- a/AndroidAsync/src/com/koushikdutta/async/http/SocketIOClient.java
+++ b/AndroidAsync/src/com/koushikdutta/async/http/SocketIOClient.java
@@ -106,7 +106,7 @@ public class SocketIOClient {
// initiate a session
Cancellable cancel = client.execute(request, new AsyncHttpClient.StringCallback() {
@Override
- public void onCompleted(final Exception e, String result) {
+ public void onCompleted(final Exception e, AsyncHttpResponse response, String result) {
if (e != null) {
reportError(ret, handler, callback, e);
return;
diff --git a/AndroidAsyncTest/src/com/koushikdutta/async/test/SocketIOTests.java b/AndroidAsyncTest/src/com/koushikdutta/async/test/SocketIOTests.java
index 3293c10..5c67086 100644
--- a/AndroidAsyncTest/src/com/koushikdutta/async/test/SocketIOTests.java
+++ b/AndroidAsyncTest/src/com/koushikdutta/async/test/SocketIOTests.java
@@ -1,9 +1,13 @@
package com.koushikdutta.async.test;
-import android.util.Log;
-import com.koushikdutta.async.AsyncServer;
-import com.koushikdutta.async.callback.CompletedCallback;
-import com.koushikdutta.async.future.Continuation;
+import java.util.concurrent.TimeUnit;
+
+import junit.framework.TestCase;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
import com.koushikdutta.async.future.SimpleFuture;
import com.koushikdutta.async.http.AsyncHttpClient;
import com.koushikdutta.async.http.SocketIOClient;
@@ -11,12 +15,6 @@ import com.koushikdutta.async.http.SocketIOClient.EventCallback;
import com.koushikdutta.async.http.SocketIOClient.JSONCallback;
import com.koushikdutta.async.http.SocketIOClient.SocketIOConnectCallback;
import com.koushikdutta.async.http.SocketIOClient.StringCallback;
-import junit.framework.TestCase;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.concurrent.TimeUnit;
public class SocketIOTests extends TestCase {
public static final long TIMEOUT = 100000L;
@@ -89,47 +87,32 @@ public class SocketIOTests extends TestCase {
assertTrue(trigger3.get(TIMEOUT, TimeUnit.MILLISECONDS));
}
- private static final String LOGTAG = "SocketIOTests";
- public void testReconnect() throws Exception {
- final TriggerFuture trigger = new TriggerFuture();
-
- Log.d(LOGTAG, "Attempting first connection");
- SocketIOClient.connect(AsyncHttpClient.getDefaultInstance(), "http://192.168.1.2:3000", new SocketIOConnectCallback() {
- @Override
- public void onConnectCompleted(Exception ex, final SocketIOClient oldClient) {
- assertNull(ex);
-
- oldClient.setClosedCallback(new CompletedCallback() {
- @Override
- public void onCompleted(Exception ex) {
- trigger.trigger(true);
- }
- });
-// Log.d(LOGTAG, "Disconnecting.");
+// public void testReconnect() throws Exception {
+// final TriggerFuture trigger = new TriggerFuture();
+//
+//
+// SocketIOClient.connect(AsyncHttpClient.getDefaultInstance(), "http://koush.clockworkmod.com:8080", new SocketIOConnectCallback() {
+// @Override
+// public void onConnectCompleted(Exception ex, final SocketIOClient oldClient) {
+// assertNull(ex);
// oldClient.disconnect();
-// Log.d(LOGTAG, "Reconnecting.");
-// AsyncServer.getDefault().postDelayed(new Runnable() {
+// oldClient.reconnect(new SocketIOConnectCallback() {
// @Override
-// public void run() {
-// oldClient.reconnect(new SocketIOConnectCallback() {
+// public void onConnectCompleted(Exception ex, SocketIOClient client) {
+// assertNull(ex);
+// assertEquals(client, oldClient);
+// client.setStringCallback(new StringCallback() {
// @Override
-// public void onConnectCompleted(Exception ex, SocketIOClient client) {
-// assertNull(ex);
-// assertEquals(client, oldClient);
-// client.setStringCallback(new StringCallback() {
-// @Override
-// public void onString(String string) {
-// trigger.trigger("hello".equals(string));
-// }
-// });
-// client.emit("hello");
+// public void onString(String string) {
+// trigger.trigger("hello".equals(string));
// }
// });
+// client.emit("hello");
// }
-// }, 3000);
- }
- });
-
- assertTrue(trigger.get(TIMEOUT, TimeUnit.MILLISECONDS));
- }
+// });
+// }
+// });
+//
+// assertTrue(trigger.get(TIMEOUT, TimeUnit.MILLISECONDS));
+// }
}