Endpoint e =
se.enumerateListenEndpoints(lc);
dispatcher.accept();
OutboundRequestIterator ori =
e.newRequest(InvocationConstraints.EMPTY);
OutboundRequest or = null;
while (ori.hasNext()) {
or = ori.next();
ObjectOutputStream oos = new ObjectOutputStream(
or.getRequestOutputStream());
oos.writeInt(1);
oos.close();
}
if (dispatcher.dispatchCalled()!=1){
throw new TestException("Dispatcher did not receive"
+ " the value sent");
}
if (!or.getDeliveryStatus()) {
throw new TestException("Call on OutboundRequest"
+ ".getDeliveryStatus() returned false for an accepted"
+ " request");
}
ArrayList endpoints = lc.getEndpoints();
Iterator it = endpoints.iterator();
while (it.hasNext()){
((EndpointHolder)it.next()).getListenHandle().close();
}
dispatcher.reject();
try {
ori = e.newRequest(InvocationConstraints.EMPTY);
while (ori.hasNext()) {
or = ori.next();
ObjectOutputStream oos = new ObjectOutputStream(
or.getRequestOutputStream());
oos.writeInt(2);
oos.close();
}
} catch (IOException ioe) {
log.finest("Expected Exception: " + ioe.getMessage());
//Expected IOException
} catch (RuntimeException re) {
throw new TestException("Dispatcher called after" +
" its associated ListenHandle was closed");
}
if (or.getDeliveryStatus()) {
throw new TestException("Call on OutboundRequest"
+ ".getDeliveryStatus() returned true for a failed"
+ " call");
}
}