protected override DescribedList OnCommand(DescribedList command)
{
if (this.innerProfile == null)
{
if (command.Descriptor.Code == Codec.SaslInit.Code)
{
var init = (SaslInit)command;
SaslMechanism saslMechanism;
if (!this.listener.saslSettings.TryGetMechanism(init.Mechanism, out saslMechanism))
{
throw new AmqpException(ErrorCode.NotImplemented, init.Mechanism);
}
this.innerProfile = saslMechanism.CreateProfile();
}
else
{
throw new AmqpException(ErrorCode.NotAllowed, command.Descriptor.Name);
}
}
return this.innerProfile.OnCommandInternal(command);
}
}