public synchronized ListenCookie addListenEndpoint(ListenEndpoint endpoint)
throws IOException {
Logger log = AbstractEndpointTest.getLogger();
RequestDispatcher rd = new SETRequestHandler();
ListenHandle lh = endpoint.listen(rd);
log.finest("The endpoint returned " + lh);
ListenHandle returnHandle = lh;
cookies.add(cookieIndex,lh);
if (useCookies!=null){
returnHandle = (ListenHandle) useCookies.get(cookieIndex);
log.finest("Returning invalid cookie " + returnHandle);
}
cookieIndex++;
endpoints.add(new EndpointHolder(endpoint,returnHandle,rd));
return returnHandle.getCookie();
}