XMLMessage rval = factory.createXMLMessage();
if (message instanceof TextMessage) {
rval = factory.createXMLTextMessage();
XMLTextMessage textRval = (XMLTextMessage) rval;
TextMessage textMessage = (TextMessage) message;
if (isBase64EncodeTextMessages()) {
byte[] bytes = base64EncoderTL.get().encode(textMessage.getText().getBytes());
textRval.setText(new String(bytes, "ASCII"));
textRval.setCodec(BASE64_CODEC);
} else {
textRval.setText(textMessage.getText());
}
} else if (message instanceof MapMessage) {
rval = factory.createXMLMapMessage();
XMLMapMessage mapRval = (XMLMapMessage) rval;