/// <summary> /// The send with retry. /// </summary> /// <param name="clientHandler"> /// The client handler. /// </param> /// <param name="send"> /// The send. /// </param> /// <param name="predicate"> /// The predicate. /// </param> /// <param name="timeout"> /// The timeout. /// </param> /// <param name="retries"> /// The retries. /// </param> /// <returns> /// The <see cref="Message"/>. /// </returns> /// <exception cref="InvalidOperationException"> /// If there is no response. /// </exception> public Message SendWithRetry( IClientHandler clientHandler, Message send, Func <Message, bool> predicate, int timeout, int retries) { for (var i = 0; i < Math.Max(retries, 1); i++) { clientHandler.Send(send); var message = this.m_MessageSideChannel.WaitUntil(predicate, timeout); if (message == null) { continue; } return(message); } throw new InvalidOperationException("No response after " + retries); }