/// <summary> /// Message handler - waits for the message of required <see cref="ResponseType"/> and when arrived, the message envelope is set to <see cref="Response"/> /// and the <see cref="WaitHandle"/> is set to signal the blocked "parent" thread that the response has been received. /// </summary> /// <param name="envelope">Incoming message envelope </param> /// <returns>True when message processed (handled) otherwise false</returns> protected virtual bool Receive(Envelope envelope) { if (!ResponseType.IsInstanceOfType(envelope.Message)) { return(false); } Response = envelope; WaitHandle.Set(); return(true); }