FudgeMsg msg = msgEnvelope.getMessage();
if (CogdaMessageType.getFromMessage(msg) != CogdaMessageType.CONNECTION_REQUEST) {
// On failure tear down the connection when http://jira.opengamma.com/browse/PLAT-2458 is done.
throw new OpenGammaRuntimeException("Cannot handle any other message than connection request as first message in COGDA protocol.");
}
ConnectionRequestMessage request = ConnectionRequestBuilder.buildObjectStatic(new FudgeDeserializer(fudgeContext), msg);
// Wrap this in synchronized to force the cache flush.
synchronized (this) {
_userPrincipal = getServer().authenticate(request.getUserName(), request.getPassword());
if (_userPrincipal != null) {
_user = getServer().getOGUser(request.getUserName());
}
}
if (getUserPrincipal() == null) {
ConnectionResponseMessage response = new ConnectionResponseMessage();