Source:
protected void handleMessage(JsonNode message) { String channelName = getChannel(message); try { JsonNode event = message.get(EVENT); KrakenEventType krakenEvent; if (event != null && (krakenEvent = KrakenEventType.getEvent(event.textValue())) != null) { switch (krakenEvent) { case pingStatus: LOG.warn("PingStatus received: {}", message); break; case pong: LOG.debug("Pong received"); break; case heartbeat: LOG.debug("Heartbeat received"); break; case systemStatus: KrakenSystemStatus systemStatus = mapper.treeToValue(message, KrakenSystemStatus.class); LOG.info("System status: {}", systemStatus); break; case subscriptionStatus: KrakenSubscriptionStatusMessage statusMessage = mapper.treeToValue(message, KrakenSubscriptionStatusMessage.class); Integer reqid = statusMessage.getReqid(); if (!isPrivate && reqid != null) channelName = subscriptionRequestMap.remove(reqid); switch (statusMessage.getStatus()) { case subscribed: LOG.info("Channel has been subscribed", channelName); if (statusMessage.getChannelID() != null) channels.put(statusMessage.getChannelID(), channelName); break; case unsubscribed: LOG.info("Channel has been unsubscribed", channelName); channels.remove(statusMessage.getChannelID()); break; case error: LOG.error( "Channel has been failed: {}", channelName, statusMessage.getErrorMessage()); } break; case error: LOG.error( "Error received: {}", message.has("errorMessage") ? message.get("errorMessage").asText() : message.toString()); break; default: LOG.warn("Unexpected event type has been received: {}", krakenEvent); } return; } } catch (JsonProcessingException e) { LOG.error("Error reading message: {}", e.getMessage(), e); } if (!message.isArray() || channelName == null) { LOG.error("Unknown message: {}", message.toString()); return; } super.handleMessage(message); }

Target:
protected void handleMessage(JsonNode message) { String channelName = getChannel(message); try { JsonNode event = message.get(EVENT); KrakenEventType krakenEvent; if (event != null && (krakenEvent = KrakenEventType.getEvent(event.textValue())) != null) { switch (krakenEvent) { case pingStatus: LOG.info("PingStatus received: {}", message); break; case pong: LOG.debug("Pong received"); break; case heartbeat: LOG.debug("Heartbeat received"); break; case systemStatus: KrakenSystemStatus systemStatus = mapper.treeToValue(message, KrakenSystemStatus.class); LOG.info("System status: {}", systemStatus); break; case subscriptionStatus: KrakenSubscriptionStatusMessage statusMessage = mapper.treeToValue(message, KrakenSubscriptionStatusMessage.class); Integer reqid = statusMessage.getReqid(); if (!isPrivate && reqid != null) channelName = subscriptionRequestMap.remove(reqid); switch (statusMessage.getStatus()) { case subscribed: LOG.info("Channel has been subscribed", channelName); if (statusMessage.getChannelID() != null) channels.put(statusMessage.getChannelID(), channelName); break; case unsubscribed: LOG.info("Channel has been unsubscribed", channelName); channels.remove(statusMessage.getChannelID()); break; case error: LOG.error( "Channel has been failed: {}", channelName, statusMessage.getErrorMessage()); } break; case error: LOG.error( "Error received: {}", message.has("errorMessage") ? message.get("errorMessage").asText() : message.toString()); break; default: LOG.warn("Unexpected event type has been received: {}", krakenEvent); } return; } } catch (JsonProcessingException e) { LOG.error("Error reading message: {}", e.getMessage(), e); } if (!message.isArray() || channelName == null) { LOG.error("Unknown message: {}", message.toString()); return; } super.handleMessage(message); }