use of com.tvd12.ezyfoxserver.constant.EzyCommand in project ezyfox-server by youngmonkeys.
the class EzyCommandTest method test.
@Test
public void test() {
EzyCommand value = EzyCommand.APP_ACCESS;
assert value.getId() == EzyCommand.APP_ACCESS.getId();
assert value == EzyCommand.valueOf(EzyCommand.APP_ACCESS.getId());
assert value.getName().equals("APP_ACCESS");
EzyCommand.valueOf("APP_ACCESS");
}
use of com.tvd12.ezyfoxserver.constant.EzyCommand in project ezyfox-server-android-client by youngmonkeys.
the class EzyTcpClient method send.
@Override
public void send(EzyRequest request, boolean encrypted) {
Object cmd = request.getCommand();
EzyData data = request.serialize();
send((EzyCommand) cmd, (EzyArray) data, encrypted);
}
use of com.tvd12.ezyfoxserver.constant.EzyCommand in project ezyfox-server-android-client by youngmonkeys.
the class EzySocketClient method processReceivedMessage.
protected void processReceivedMessage(EzyArray message) {
int cmdId = message.get(0, int.class);
EzyArray data = message.get(1, EzyArray.class, null);
EzyCommand cmd = EzyCommand.valueOf(cmdId);
printReceivedData(cmd, data);
if (cmd == EzyCommand.DISCONNECT) {
int reasonId = data.get(0, int.class);
disconnectReason = reasonId;
socketStatuses.push(EzySocketStatus.DISCONNECTING);
} else {
dataHandlers.handle(cmd, data);
}
}
use of com.tvd12.ezyfoxserver.constant.EzyCommand in project ezyfox-server-android-client by youngmonkeys.
the class EzyTcpClient method send.
@Override
public void send(EzyCommand cmd, EzyArray data, boolean encrypted) {
boolean shouldEncrypted = encrypted;
if (encrypted && sessionKey == null) {
if (config.isEnableDebug()) {
shouldEncrypted = false;
} else {
throw new IllegalArgumentException("can not send command: " + cmd + " " + "you must enable SSL or enable debug mode by configuration " + "when you create the client");
}
}
EzyArray array = requestSerializer.serialize(cmd, data);
if (socketClient != null) {
socketClient.sendMessage(array, shouldEncrypted);
printSentData(cmd, data);
}
}
Aggregations