protected void logMessage(String logMessage, String message, boolean incoming) {
if (messageListener != null) {
log.info(logMessage);
if (incoming) {
messageListener.onInboundMessage(new RawMessage(message), null);
} else {
messageListener.onOutboundMessage(new RawMessage(message), null);
}
} else {
log.info(logMessage + ":" + System.getProperty("line.separator") + message);
}
}