/**
* Encrypt and send a connect request, decrypt the returned data
*/
private void connect(MsgQueueEntry entry) throws XmlBlasterException {
MsgQueueConnectEntry connectEntry = (MsgQueueConnectEntry)entry;
this.sessionName = connectEntry.getConnectQosData().getSessionName();
String encryptedConnectQos = getEncryptedConnectQos(connectEntry.getConnectQosData());
// TODO: pass connectEntry.getConnectQosData().getSender().getLoginName(); as this is used by SOCKET:requestId
String rawReturnVal = this.driver.connect(encryptedConnectQos); // Invoke remote server
connectionsHandler.getDispatchStatistic().incrNumConnect(1);
if (securityInterceptor != null) { // decrypt return value ...
CryptDataHolder dataHolder = new CryptDataHolder(MethodName.CONNECT, new MsgUnitRaw(null, (byte[])null, rawReturnVal));
dataHolder.setReturnValue(true);
rawReturnVal = securityInterceptor.importMessage(dataHolder).getQos();
}
try {
this.connectReturnQos = new ConnectReturnQos(glob, rawReturnVal);
setCheckpointContext(this.connectReturnQos);
}
catch (XmlBlasterException e) {
log.severe("Can't parse returned connect QoS value '" + rawReturnVal + "': " + e.getMessage());
throw e;
}
if (!connectEntry.getConnectQosData().getSessionName().isSession()) {
// We need to remember the server side assigned public session id for reconnect polling
// If do we should probably take a clone:
//ConnectQos connectQos = new ConnectQos(this.glob, this.connectReturnQos.getData());
ConnectQosData connectQos = connectEntry.getConnectQosData();
connectQos.setSessionName(this.connectReturnQos.getSessionName());
this.sessionName = this.connectReturnQos.getSessionName();
connectQos.getSessionQos().setSecretSessionId(this.connectReturnQos.getSecretSessionId());
this.connectQosData = connectQos;
}
if (connectEntry.wantReturnObj()) {
connectEntry.setReturnObj(this.connectReturnQos);
}
this.driver.setConnectReturnQos(this.connectReturnQos);
}