public class GetDeliveryStatusTest extends AbstractEndpointTest {
public void run() throws Exception {
ServerEndpoint se = getServerEndpoint();
GetDeliveryDispatcher dispatcher = new GetDeliveryDispatcher();
GetDeliveryContext lc = new GetDeliveryContext(dispatcher);
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();