public void TestAcceptChannel() { IChannel cacheServiceChannel = connection.OpenChannel(CacheServiceProtocol.Instance, "CacheServiceProxy", null, null); EnsureCacheRequest ensureCacheRequest = (EnsureCacheRequest)cacheServiceChannel.MessageFactory.CreateMessage( EnsureCacheRequest.TYPE_ID); ensureCacheRequest.CacheName = CacheName; string response = (string)cacheServiceChannel.Request(ensureCacheRequest); Uri uri = new Uri(response); Assert.IsNotNull(uri); int id; id = Int32.Parse(UriUtils.GetSchemeSpecificPart(uri)); Assert.IsTrue(id > 0); Assert.IsTrue(connection.GetChannel(id) == null); AcceptChannel acceptChannel = (AcceptChannel)connection.GetChannel(0).MessageFactory.CreateMessage( AcceptChannel.TYPE_ID); Assert.IsInstanceOf(typeof(AcceptChannel), acceptChannel); Assert.AreEqual(AcceptChannel.TYPE_ID, acceptChannel.TypeId); acceptChannel.ChannelUri = uri; acceptChannel.Connection = (Connection)connection; IResponse acceptChannelResponse = connection.GetChannel(0).Send(acceptChannel).WaitForResponse(-1); Assert.IsInstanceOf(typeof(InternalResponse), acceptChannelResponse); Request.RequestStatus status = (Request.RequestStatus)acceptChannelResponse.Result; Assert.IsNotNull(status); Assert.IsNull(status.Exception); Assert.IsInstanceOf(typeof(AcceptChannelRequest), status.Request); }