throw new TestException(
"OutgoingMulticastRequest.marshal returned non-1 array");
}
// Ensure that the single packet unmarshals sanely.
IncomingMulticastRequest r = new IncomingMulticastRequest(reqs[0]);
if (r.getGroups().length != 0) {
throw new TestException("IncomoingMulticastRequest.getGroups "
+ "returned non-empty array");
}
/*
* Try to marshal a normal-looking request, and ensure that it
* checks out.
*/
reqs = OutgoingMulticastRequest.marshal(port, grps, sids);
if (reqs == null) {
throw new TestException(
"OutgoingMulticastRequest.marshal returned null");
}
if (reqs.length == 0) {
throw new TestException(
"OutgoingMulticastRequest.marshal returned empty array");
}
logger.log(Level.INFO, "Marshaled " + reqs.length + " packets");
Collection marshaledGroups = new HashSet();
for (int i = 0; i < reqs.length; i++) {
if (reqs[i].getData().length > 512) {
throw new TestException(
"request data is too large, at "
+ reqs[i].getData().length + " bytes");
}
IncomingMulticastRequest req = new IncomingMulticastRequest(reqs[i]);
if (req.getPort() != port) {
throw new TestException(
"unmarshaled a bad port number");
}
String[] groupsU = req.getGroups();
for (int j = 0; j < groupsU.length; j++) {
if (!grpSet.contains(groupsU[j])) {
throw new TestException("unmarshaled a group we "
+ "didn't marshal");
}
marshaledGroups.add(groupsU[j]);
}
ServiceID[] serviceIDsU = req.getServiceIDs();
for (int j = 0; j < serviceIDsU.length; j++) {
if (!sidSet.contains(serviceIDsU[j])) {
throw new TestException("unmarshaled a service ID "
+ "we didn't marshal");