public class MessageExchangeImplTest extends TestCase {
private static final Log log = LogFactory.getLog(MessageExchangeImplTest.class);
protected void testSerializeDeserialize(Source src) throws Exception {
MessageExchange me = new InOnlyImpl("exchangeId");
me.setOperation(new QName("uri", "op"));
me.setProperty("myProp", "myValue");
NormalizedMessage msg = me.createMessage();
msg.setProperty("myMsgProp", "myMsgValue");
msg.setContent(src);
msg.addAttachment("myAttachment", new DataHandler(new StreamDataSource(new ByteArrayInputStream("hello".getBytes()))));
me.setMessage(msg, "in");
assertNotNull(((NormalizedMessageImpl) msg).getBody());
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(me);