public void test_EnqueueWithRelay() { MQConnection con = null; try { con = connectToServer(address, null, null); QueueMessage msg = new QueueMessage(); StreamWriter sw = new StreamWriter(msg.Stream); sw.WriteLine(SPECIAL_MESSAGE); sw.Close(); addAllQueues(con); ErrorCode ec = con.EnqueueWithRelay(new Uri(addressString + "/" + TEST_QUEUE[1]), msg); Assert.IsTrue(ec == ErrorCode.EC_NOERROR, "Unble to EnqueueWithRelay:" + ec); Thread.Sleep(100); QueueHandle handle = new QueueHandle(); ec = con.OpenQueue(TEST_QUEUE[1], handle); Assert.IsTrue(ec == ErrorCode.EC_NOERROR, "Unble to OpenQueue:" + ec); msg = new QueueMessage(); ec = con.Retrieve(handle, true, 0, msg); Assert.IsTrue(ec == ErrorCode.EC_NOERROR, "Unble to Retrieve:" + ec); string txt = (new StreamReader(msg.Stream)).ReadLine(); Assert.IsTrue(txt.Equals(SPECIAL_MESSAGE), "Incorrect Message: " + txt); ec = con.CloseQueue(handle); Assert.IsTrue(ec == ErrorCode.EC_NOERROR, "Unble to CloseQueue:" + ec); } finally { if (con != null) { con.Close(); } } }