Coverage Report - org.mule.transport.tcp.protocols.MuleMessageDirectProtocol
 
Classes in this File Line Coverage Branch Coverage Complexity
MuleMessageDirectProtocol
0%
0/8
N/A
0
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.transport.tcp.protocols;
 8  
 
 9  
 import org.mule.api.MuleContext;
 10  
 import org.mule.api.context.MuleContextAware;
 11  
 import org.mule.transformer.wire.SerializedMuleMessageWireFormat;
 12  
 
 13  
 import java.io.IOException;
 14  
 import java.io.InputStream;
 15  
 import java.io.OutputStream;
 16  
 
 17  
 /**
 18  
  * This Protocol will send the actual Mule Message over the TCP channel, and in this
 19  
  * way we are preserving any headers which might be needed, for example Correlation
 20  
  * IDs in order to be able to aggregate messages after chunking.  Data are read until
 21  
  * no more are (momentarily) available.
 22  
  */
 23  0
 public class MuleMessageDirectProtocol extends DirectProtocol implements MuleContextAware
 24  
 {
 25  
 
 26  0
     private final SerializedMuleMessageWireFormat wireFormat = new SerializedMuleMessageWireFormat();
 27  0
     private final MuleMessageWorker messageWorker = new MuleMessageWorker(wireFormat);
 28  
 
 29  
     @Override
 30  
     public Object read(InputStream is) throws IOException
 31  
     {
 32  0
         return messageWorker.doRead(super.read(is));
 33  
     }
 34  
 
 35  
     @Override
 36  
     public void write(OutputStream os, Object data) throws IOException
 37  
     {
 38  0
         super.write(os, messageWorker.doWrite());
 39  0
     }
 40  
 
 41  
     public void setMuleContext(MuleContext context)
 42  
     {
 43  0
         wireFormat.setMuleContext(context);
 44  0
     }
 45  
 }