{
if (log.isLoggable(Level.FINE)) log.fine("Subscribing ...");
String passwd = "secret";
SubscribeKey subKeyW = new SubscribeKey(glob, publishOid1);
String subKey = subKeyW.toXml(); // "<key oid='" + publishOid1 + "' queryType='EXACT'></key>";
SubscribeQos subQosW = new SubscribeQos(glob); // "<qos></qos>";
String subQos = subQosW.toXml();
manyClients = new Client[numClients];
long usedBefore = getUsedServerMemory();
log.info("Setting up " + numClients + " subscriber clients ...");
stopWatch = new StopWatch();
for (int ii=0; ii<numClients; ii++) {
Client sub = new Client();
sub.loginName = "Joe-" + ii;
try {
Global globTmp = glob.getClone(null);
sub.connection = globTmp.getXmlBlasterAccess();
ConnectQos loginQosW = new ConnectQos(globTmp, sub.loginName, passwd); // "<qos></qos>"; During login this is manipulated (callback address added)
sub.connection.connect(loginQosW, this);
}
catch (Exception e) {
log.severe("Login failed: " + e.toString());
assertTrue("Login failed: " + e.toString(), false);
}
try {
sub.subscribeOid = sub.connection.subscribe(subKey, subQos).getSubscriptionId();
log.info("Client " + sub.loginName + " subscribed to " + subKeyW.getOid());
} catch(XmlBlasterException e) {
log.warning("XmlBlasterException: " + e.getMessage());
assertTrue("subscribe - XmlBlasterException: " + e.getMessage(), false);
}