}
Iterator it = endpoints.iterator();
while(it.hasNext()) {
EndpointHolder eph = (EndpointHolder) it.next();
SETRequestHandler rh = (SETRequestHandler)
eph.getRequestHandler();
if (response != rh.hashCode()){
throw new TestException("The response received"
+ "does not match the response sent by the server"
+ "side of the connection. Server sent "
+ rh.hashCode() + ", but the client got " + response);
}
ArrayList requests = rh.getRequests();
if (requests.size()!=1){
throw new TestException("The RequestDisptcher"
+ " received the incorrect number of requests. "
+ "Expected 1 and received " + requests.size());
}
Iterator requestIterator = requests.iterator();
while (requestIterator.hasNext()){
Integer value = (Integer) requestIterator.next();
if (value.intValue()!=this.hashCode()){
throw new TestException("The data read from"
+ " the InboundRequest does not match the data"
+ " written to the OutboundRequest. Wrote "
+ this.hashCode() + " read " + value);
}
}
ServerEndpoint.ListenHandle lh = eph.getListenHandle();
//Close the listen operation
lh.close();
}
//Verify that new requests are not received after close has
//been called on the ListenHandle
try {
ori = e.newRequest(InvocationConstraints.EMPTY);
while (ori.hasNext()) {
OutboundRequest or = ori.next();
ObjectOutputStream oos =
new ObjectOutputStream(or.getRequestOutputStream());
oos.writeInt(this.hashCode());
oos.close();
}
it = endpoints.iterator();
while(it.hasNext()) {
EndpointHolder eph = (EndpointHolder) it.next();
SETRequestHandler rh = (SETRequestHandler)
eph.getRequestHandler();
ArrayList requests = rh.getRequests();
if (requests.size()!=1){
throw new TestException("Requests were"
+ " delivered to the server after a close operation"
+ " on the ListenHandle");
}