use of org.jgroups.blocks.RequestOptions in project JGroups by belaban.
the class MessageDispatcherRSVPTest method sendMessageOnClosedChannel.
protected void sendMessageOnClosedChannel(Address dest, Message.Flag... flags) throws Exception {
RequestOptions opts = RequestOptions.SYNC().timeout(2000).flags(flags);
byte[] data = "bla".getBytes();
ByteArray buf = new ByteArray(data, 0, data.length);
channels[0].close();
try {
if (dest == null) {
// multicast
Address dst = channels[1].getAddress();
dispatchers[0].castMessage(Collections.singleton(dst), new BytesMessage(dst, buf), opts);
} else
dispatchers[0].sendMessage(new BytesMessage(dest, buf), opts);
assert false : "sending the message on a closed channel should have thrown an exception";
} catch (IllegalStateException t) {
System.out.println("received \"" + t + "\" as expected");
}
}
Aggregations