responseListener =
new MonitoredDestinationListener(
"StreamData MessageListener [id: " + _listenerId++
+ "]");
final SenderDestination senderDestination =
DestinationFactory.createNonBlockingSenderDestination(
_context, uri, responseListener);
// Create a byte array of size 10000
final byte[] input = new byte[10000];
for (int i = 0; i < input.length; i++) {
input[i] = '5';
}
final ByteArrayInputStream bais = new ByteArrayInputStream(input);
final StreamMessage message =
senderDestination.createStreamMessage();
((HttpMessage) message).setMethod(HttpMessage.POST);
message.setStreamPayload(bais);
message.setPriority(2);
message.setTransportHeader("Transfer-Encoding", "chunked");