Skip to content

Instantly share code, notes, and snippets.

@icapurro
Created June 8, 2015 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icapurro/88dd4668464266f8c3a3 to your computer and use it in GitHub Desktop.
Save icapurro/88dd4668464266f8c3a3 to your computer and use it in GitHub Desktop.
import com.github.nkzawa.socketio.client.Manager;
import com.github.nkzawa.socketio.client.Socket;
import org.json.JSONException;
import org.json.JSONObject;
public class SocketServerStub {
protected Socket socket = new SocketStub(new Manager(), null);
public Socket getSocket() {
return socket;
}
public void connect() {
socket.emit(Socket.EVENT_CONNECT);
}
public void emit(String event, String jsonString) throws JSONException {
JSONObject obj = new JSONObject(jsonString);
socket.emit(event, obj);
}
public void disconnect() {
socket.emit(Socket.EVENT_DISCONNECT);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment