public Tank(String bubbleAssetCacheUrl, String serverAddress, int serverPort, int hubPort) { String programName = "Metaverse Exchange Tank"; byte programMajorVersion = 0; byte programMinorVersion = 4; server = new MxpServer(bubbleAssetCacheUrl, serverPort, programName, programMajorVersion, programMinorVersion); hub = new MxpHub(bubbleAssetCacheUrl, serverAddress, hubPort, programName, programMajorVersion, programMinorVersion); }
public CloudService( String bubbleAssetCacheUrl, String serverAddress, int hubPort, int serverPort, String programName, byte programMajorVersion, byte programMinorVersion ) { this.hub = new MxpHub(bubbleAssetCacheUrl, serverAddress, hubPort, programName, programMajorVersion, programMinorVersion); this.server = new MxpServer(bubbleAssetCacheUrl, serverPort, programName, programMajorVersion, programMinorVersion); }
public void HubConnectionSuccess() { Guid sourceBubbleGuid = new Guid(); Guid targetBubbleGuid = new Guid(); MxpHub sourceHub = new MxpHub("http://test.cloud.url", "127.0.0.1", MxpConstants.DefaultHubPort, "TestServerProgram", 1, 2); MxpBubble sourceBubble = new MxpBubble(sourceBubbleGuid, "SourceBubbleName", 100, 1000); sourceHub.AddBubble(sourceBubble); Session sourceSession = null; sourceBubble.BubbleConnected += delegate(Session session, Message message) { sourceSession = session; }; sourceHub.Startup(false); MxpHub targetHub = new MxpHub("http://test.cloud.url", "127.0.0.1", MxpConstants.DefaultHubPort + 1, "TestServerProgram", 1, 2); MxpBubble targetBubble = new MxpBubble(targetBubbleGuid, "TargetBubbleName", 100, 1000); targetHub.AddBubble(targetBubble); Session targetSession = null; targetBubble.BubbleConnectAuthorize += delegate(Session session, AttachRequestMessage message) { return(true); }; targetBubble.BubbleConnected += delegate(Session session, Message message) { targetSession = session; }; targetHub.Startup(false); sourceHub.Connect(sourceBubbleGuid, targetBubbleGuid, "127.0.0.1", MxpConstants.DefaultHubPort + 1, 100, 100, 100); Thread.Sleep(20); targetHub.Process(); Thread.Sleep(20); sourceHub.Process(); Thread.Sleep(20); targetHub.Process(); Thread.Sleep(20); sourceHub.Process(); Thread.Sleep(20); targetHub.Process(); Thread.Sleep(20); sourceHub.Process(); Thread.Sleep(20); targetHub.Process(); Thread.Sleep(20); sourceHub.Process(); Assert.IsNotNull(sourceSession); Assert.IsTrue(sourceSession.IsConnected); Assert.IsNotNull(targetSession); Assert.IsTrue(targetSession.IsConnected); Assert.AreEqual(1, sourceHub.SessionCount); Assert.AreEqual(1, targetHub.SessionCount); targetHub.Disconnect(targetSession); Thread.Sleep(20); targetHub.Process(); Thread.Sleep(20); sourceHub.Process(); Thread.Sleep(20); targetHub.Process(); Thread.Sleep(20); sourceHub.Process(); Thread.Sleep(20); targetHub.Process(); Thread.Sleep(20); sourceHub.Process(); Thread.Sleep(20); targetHub.Process(); Thread.Sleep(20); sourceHub.Process(); Assert.IsFalse(sourceSession.IsConnected); Assert.IsFalse(targetSession.IsConnected); Assert.AreEqual(0, sourceHub.SessionCount); Assert.AreEqual(0, targetHub.SessionCount); sourceHub.Shutdown(); targetHub.Shutdown(); }