try {
AmfTrace trace = null;
trace = new AmfTrace();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
AmfMessageSerializer amfser = new AmfMessageSerializer();
SerializationContext context = SerializationContext.getSerializationContext();
context.instantiateTypes = false;
amfser.initialize(context, baos, trace);
amfser.writeMessage(message);
messageBytes = baos.toByteArray();
if (DEBUG) {
System.out.println(dump("", messageBytes, 0, messageBytes.length));
System.err.println(trace);