public void Disconnect() { client.Disconnect(); client.Process(); Thread.Sleep(10); client.Process(); Thread.Sleep(10); client.Process(); }
public void Shutdown() { if (IsAlive) { isExitRequested = true; client.Disconnect(); while (IsAlive) { Thread.Sleep(100); } isExitRequested = false; thread = null; } }
public void Shutdown() { Client.Disconnect(); }
public void ClientServerConnectionSuccess() { Guid bubbleGuid = new Guid(); MxpServer server = new MxpServer("http://test.cloud.url", MxpConstants.DefaultHubPort, "TestServerProgram", 1, 2); MxpBubble bubble = new MxpBubble(bubbleGuid, "TestBubbleName", 100, 1000); server.AddBubble(bubble); Session serverSession = null; bubble.ParticipantConnectAuthorize += delegate(Session session, JoinRequestMessage message, out Guid participantId, out Guid avatarId ) { participantId = Guid.Empty; avatarId = Guid.Empty; return(true); }; bubble.ParticipantConnected += delegate(Session session, JoinRequestMessage message, Guid participantId, Guid avatarId) { serverSession = session; }; server.Startup(false); MxpClient client = new MxpClient("TestClientProgram", 1, 2); client.ServerMessageReceived += delegate(Message message) { }; client.Connect("127.0.0.1", MxpConstants.DefaultHubPort, bubbleGuid, "", "TestLocation", "TestIdentityProviderUrl", "TestUserName", "TestUserPassword", Guid.Empty, false); Thread.Sleep(20); client.Process(); Thread.Sleep(20); server.Process(); Thread.Sleep(20); client.Process(); Thread.Sleep(20); server.Process(); Thread.Sleep(20); client.Process(); Thread.Sleep(20); server.Process(); Thread.Sleep(20); client.Process(); Thread.Sleep(20); server.Process(); Assert.IsNotNull(serverSession); Assert.IsTrue(serverSession.IsConnected); Thread.Sleep(20); client.Process(); Thread.Sleep(20); server.Process(); Thread.Sleep(20); client.Process(); Thread.Sleep(20); server.Process(); Assert.IsTrue(client.IsConnected); client.Disconnect(); Thread.Sleep(20); server.Process(); Thread.Sleep(20); client.Process(); Thread.Sleep(20); server.Process(); Thread.Sleep(20); client.Process(); Thread.Sleep(20); server.Process(); Thread.Sleep(20); client.Process(); Assert.IsFalse(client.IsConnected); Assert.IsFalse(serverSession.IsConnected); server.Shutdown(); }