use of org.apache.synapse.transport.passthru.PassThroughHttpSender in project wso2-synapse by wso2.
the class ServiceUtils method receive.
/**
* This will provide the mocking functionality of AxisEngine.receive() method.
* when AxisEngine is mocked, this method can be used with doAnswer
*
* @param axis2MessageContext
* @throws IOException
* @throws HttpException
*/
public static void receive(MessageContext axis2MessageContext) throws IOException, HttpException {
if (axis2MessageContext.getServiceContext() == null) {
ServiceContext svcCtx = new ServiceContext();
OperationContext opCtx = new OperationContext(new InOutAxisOperation(), svcCtx);
axis2MessageContext.setServiceContext(svcCtx);
axis2MessageContext.setOperationContext(opCtx);
}
PassThroughHttpSender sender = new PassThroughHttpSender();
ConfigurationContext cfgCtx = new ConfigurationContext(new AxisConfiguration());
sender.init(cfgCtx, new TransportOutDescription("http"));
sender.invoke(axis2MessageContext);
}
Aggregations