use of org.apache.axis2.transport.testkit.message.IncomingMessage in project wso2-axis2-transports by wso2.
the class MailRequestResponseClient method sendMessage.
public IncomingMessage<byte[]> sendMessage(ClientOptions options, ContentType contentType, byte[] message) throws Exception {
String msgId = sendMessage(contentType, message);
Message reply = waitForReply(msgId);
Assert.assertNotNull("No response received", reply);
Assert.assertEquals(channel.getSender().getAddress(), ((InternetAddress) reply.getRecipients(Message.RecipientType.TO)[0]).getAddress());
Assert.assertEquals(channel.getRecipient().getAddress(), ((InternetAddress) reply.getFrom()[0]).getAddress());
ByteArrayOutputStream baos = new ByteArrayOutputStream();
reply.getDataHandler().writeTo(baos);
return new IncomingMessage<byte[]>(new ContentType(reply.getContentType()), baos.toByteArray());
}
Aggregations