case Event.MSG:
Message msg = (Message) evt.getArg();
GmsHeader hdr = (GmsHeader) msg.getHeader(GMS_ID);
if (needsAuthentication(hdr)) {
// We are a client who needs to authenticate
SaslClientContext ctx = null;
Address remoteAddress = msg.getDest();
try {
ctx = new SaslClientContext(saslClientFactory, mech, server_name != null ? server_name : remoteAddress.toString(), client_callback_handler, sasl_props, client_subject);
sasl_context.put(remoteAddress, ctx);
ctx.addHeader(msg, null);
} catch (Exception e) {
if (ctx != null) {
disposeContext(remoteAddress);
}
throw new SecurityException(e);