// Execute client selected profiles
//
List profileList = selectProfiles(serverProfiles);
for (Iterator i = profileList.iterator(); i.hasNext(); ) {
String profile = (String) i.next();
ProfileClient p =
ProfileClientFactory.createProfile(profile, env);
if (logger.traceOn()) {
logger.trace("connectionOpen",
">>>>> Profile " +
p.getClass().getName() +
" <<<<<");
}
ProfileMessage pm = null;
p.initialize(mc);
while (!p.isComplete()) {
pm = p.produceMessage();
mc.writeMessage(pm);
msg = mc.readMessage();
if (msg instanceof ProfileMessage) {
p.consumeMessage((ProfileMessage)msg);
} else if (msg instanceof HandshakeErrorMessage) {
// Throw exception and let GenericConnector
// close the connection
//
sendError = false;
error = (HandshakeErrorMessage) msg;
throwExceptionOnError(error);
} else {
throw new IOException("Unexpected message: " +
msg.getClass().getName());
}
}
p.activate();
profilesList.add(p);
}
// Send client handshake end
//