private void _testWithProps(boolean mcast, String cluster_name) throws Exception {
Map<String,Object> m=new HashMap<String,Object>();
m.put("additional_data", new byte[] { 'b', 'e', 'l', 'a' });
byte[] buf=new byte[1000];
JChannel ch1=null, ch2=null;
try {
ch1=createChannel(true, 2);
ch1.down(new Event(Event.CONFIG, m));
ch2=createChannel(ch1); // same props as ch1 above
ch2.down(new Event(Event.CONFIG, m));
MyReceiver receiver=new MyReceiver();
ch2.setReceiver(receiver);
ch1.connect(cluster_name);
ch2.connect(cluster_name);
if(mcast)
ch1.send(new Message(null, null, buf));
else {
Address dest=ch2.getAddress();
ch1.send(new Message(dest, null, buf));
}
Util.sleep(500); // msgs are sent asynchronously, give ch2 some time to receive them
List<Message> list=receiver.getMsgs();
assert !list.isEmpty();
Message msg=list.get(0);
UUID src=(UUID)msg.getSrc();
assert src != null;
assert src.getAdditionalData() != null;
assert src.getAdditionalData().length == 4;
}
finally {
if(ch2 != null) ch2.close();
if(ch1 != null) ch1.close();
}
}