final MessageType messageType = JsonUtil.parseFrame(message);
logger.info("messageType: " + messageType.getMessageType());
switch (messageType.getMessageType()) {
case HELLO:
if (!checkHandshakeCompleted(uaid)) {
final HelloResponse response = simplePushServer.handleHandshake(fromJson(message, HelloMessageImpl.class));
session.send(toJson(response));
uaid = response.getUAID();
userAgents.add(uaid, session);
processUnacked(uaid, session, 0);
logger.info("UserAgent [" + uaid + "] handshake done");
}
break;
case REGISTER:
if (checkHandshakeCompleted(uaid)) {
final RegisterResponse response = simplePushServer.handleRegister(fromJson(message, RegisterMessageImpl.class), uaid);
session.send(toJson(response));
logger.info("UserAgent [" + uaid + "] Registered[" + response.getChannelId() + "]");
}
break;
case UNREGISTER:
if (checkHandshakeCompleted(uaid)) {
final UnregisterMessage unregister = fromJson(message, UnregisterMessageImpl.class);
final UnregisterResponse response = simplePushServer.handleUnregister(unregister, uaid);
session.send(toJson(response));
logger.info("UserAgent [" + uaid + "] Unregistered[" + response.getChannelId() + "]");
}
break;
case ACK:
if (checkHandshakeCompleted(uaid)) {
final AckMessage ack = fromJson(message, AckMessageImpl.class);