public void Send(MessageFrame frame) { if (frame == null) { throw new ArgumentNullException("frame"); } //if (!_authenticationEvent.WaitOne(100000)) // throw new InvalidOperationException("Handshake was not completed in a reasonable time."); if (_ackReceiver != null) { // we can allow all requests to send messages // if if (_messageStore != null) { _messageStore.Enqueue(frame); if (_ackReceiver.CanSend(frame)) { _ackReceiver.Send(frame); } } else { if (!_ackReceiver.CanSend(frame)) { throw new InvalidOperationException("Cannot enqueue more messages that the given threshold."); } _ackReceiver.Send(frame); } } else { DeliverMessage(frame); } }