final ByteArrayOutputStream cache = new ByteArrayOutputStream();
final DelegatingOutputStream delegating = new DelegatingOutputStream(cache);
message.setContent(OutputStream.class, delegating);
message.setContent(DelegatingOutputStream.class, delegating);
OutputHandler handler = new OutputHandler()
{
public void write(MuleEvent event, OutputStream out) throws IOException
{
out.write(cache.toByteArray());