示例#1
0
        public void OnEjectRequest(RemoteParticipant participant, EjectRequestMessage ejectRequest)
        {
            EjectResponseMessage ejectResponse = new EjectResponseMessage();
            ejectResponse.MessageId = ejectRequest.MessageId;

            if (IdObjectDictionary.ContainsKey(ejectRequest.ObjectId))
            {
                TankObject obj = IdObjectDictionary[ejectRequest.ObjectId];

                if (obj.OwnerId == participant.ParticipantId)
                {
                    RemoveObject(obj);
                    ObjectEjected(obj);

                    ejectResponse.FailureCode = MxpResponseCodes.SUCCESS;
                    participant.Session.Send(ejectResponse);
                }
                else
                {
                    ejectResponse.FailureCode = MxpResponseCodes.UNAUTHORIZED_OPERATION;
                    participant.Session.Send(ejectResponse);
                }
            }
            else
            {
                ejectResponse.FailureCode = MxpResponseCodes.UNKNOWN_OBJECT_ID;
                participant.Session.Send(ejectResponse);
            }

        }
        public void EjectRequestMessageClear()
        {
            EjectRequestMessage originalMessage = new EjectRequestMessage();

            originalMessage.ObjectId = Guid.NewGuid();

            originalMessage.Clear();
            EjectRequestMessage emptyMessage = new EjectRequestMessage();

            emptyMessage.MessageId = originalMessage.MessageId;
            Assert.AreEqual(originalMessage.ToString(), emptyMessage.ToString());
        }
示例#3
0
 private void EjectObject(DaemonLogic.CloudObject cloudObject)
 {
     if (Objects.Contains(cloudObject))
     {
         Objects.Remove(cloudObject);
         IdObjectDictionary.Remove(cloudObject.CloudObjectId);
         if (InjectedObjects.Contains(cloudObject.CloudObjectId))
         {
             InjectedObjects.Remove(cloudObject.CloudObjectId);
             EjectRequestMessage ejectRequestMessage = new EjectRequestMessage();
             ejectRequestMessage.ObjectId = cloudObject.CloudObjectId;
             client.EjectObject(ejectRequestMessage);
         }
     }
 }
        public void EjectRequestMessageEncoding()
        {
            EjectRequestMessage originalMessage = new EjectRequestMessage();

            originalMessage.ObjectId = Guid.NewGuid();

            byte[] encodedBytes = new byte[originalMessage.FrameDataSize(0)];

            int dataLength = originalMessage.EncodeFrameData(0, encodedBytes, 0);

            EjectRequestMessage decodedMessage = new EjectRequestMessage();

            decodedMessage.DecodeFrameData(0, encodedBytes, 0, dataLength);



            decodedMessage.MessageId = originalMessage.MessageId;


            String originalMessageString = originalMessage.ToString();
            String decodedMessageString  = decodedMessage.ToString();

            Assert.AreEqual(originalMessageString, decodedMessageString);
        }
示例#5
0
 public void EjectObject(EjectRequestMessage ejectRequest)
 {
     client.Send(ejectRequest);
 }
示例#6
0
        private void Process()
        {
            while (!isExitRequested)
            {
                try
                {
                    client.Process();

                    if (((DateTime.Now.Subtract(lastInjectEjectTime).TotalSeconds > 300 && isInjected) || (DateTime.Now.Subtract(lastInjectEjectTime).TotalSeconds > 1 && !isInjected)) && client.IsConnected)
                    {
                        if (!isInjected)
                        {
                            for (int i = 0; i < NumberOfObjects; i++)
                            {
                                // Reset objects
                                InjectRequestMessage injectRequestMessage = (InjectRequestMessage)MessageFactory.Current.ReserveMessage(typeof(InjectRequestMessage));
                                injectRequestMessage.ObjectFragment.OwnerId    = ParticipantId;
                                injectRequestMessage.ObjectFragment.ObjectId   = ObjectArray[i].ObjectId;
                                injectRequestMessage.ObjectFragment.ObjectName = ObjectArray[i].ObjectName;
                                injectRequestMessage.ObjectFragment.TypeId     = TypeId;
                                injectRequestMessage.ObjectFragment.TypeName   = "TestType";

                                ObjectArray[i].Location[0] = (float)(ObjectArray[i].OrbitRadius * Math.Cos(ObjectArray[i].OrbitAngle));
                                ObjectArray[i].Location[1] = 0.5f;
                                ObjectArray[i].Location[2] = (float)(ObjectArray[i].OrbitRadius * Math.Sin(ObjectArray[i].OrbitAngle));

                                injectRequestMessage.ObjectFragment.Location.X = ObjectArray[i].Location[0];
                                injectRequestMessage.ObjectFragment.Location.Y = ObjectArray[i].Location[1];
                                injectRequestMessage.ObjectFragment.Location.Z = ObjectArray[i].Location[2];

                                injectRequestMessage.ObjectFragment.BoundingSphereRadius = ObjectArray[i].ObjectBoundingSphereRadius;
                                client.Send(injectRequestMessage);

                                if (i % 10 == 9)
                                {
                                    client.Process();
                                    Thread.Sleep(10);
                                }
                            }

                            isInjected = true;
                        }
                        else
                        {
                            for (int i = 0; i < NumberOfObjects; i++)
                            {
                                EjectRequestMessage ejectRequestMessage = (EjectRequestMessage)MessageFactory.Current.ReserveMessage(typeof(EjectRequestMessage));
                                ejectRequestMessage.ObjectId = ObjectArray[i].ObjectId;
                                client.Send(ejectRequestMessage);

                                if (i % 10 == 9)
                                {
                                    client.Process();
                                    Thread.Sleep(10);
                                }
                            }

                            isInjected = false;
                        }
                        lastInjectEjectTime = DateTime.Now;
                    }
                    else
                    {
                        if (!client.IsConnecting && !client.IsConnected && !isExitRequested)
                        {
                            // Mark for reinject on reconnect
                            isInjected = false;

                            client.Connect(serverAddress, serverPort, bubbleId, "", location, identityProviderUrl, participantName, participantPassphrase, Guid.Empty, false);
                        }
                    }

                    if (client.IsConnected && DateTime.Now.Subtract(lastUpdateTime).TotalMilliseconds > 500 && isInjected)
                    {
                        float timeDelta = (float)DateTime.Now.Subtract(lastUpdateTime).TotalSeconds;

                        for (int i = 0; i < NumberOfObjects; i++)
                        {
                            //if (ObjectArray[i].Velocity[0] >= 0.01f || ObjectArray[i].Velocity[1] >= 0.01f || ObjectArray[i].Velocity[2] >= 0.01f)
                            //{
                            ObjectArray[i].Location[0] += ObjectArray[i].Velocity[0] * timeDelta;
                            ObjectArray[i].Location[1] += ObjectArray[i].Velocity[1] * timeDelta;
                            ObjectArray[i].Location[2] += ObjectArray[i].Velocity[2] * timeDelta;

                            ObjectArray[i].Velocity[0] *= 0.9f;
                            ObjectArray[i].Velocity[1] *= 0.9f;
                            ObjectArray[i].Velocity[2] *= 0.9f;

                            //}

                            if (Math.Sqrt(ObjectArray[i].Velocity[0] * ObjectArray[i].Velocity[0] +
                                          ObjectArray[i].Velocity[1] * ObjectArray[i].Velocity[1] +
                                          ObjectArray[i].Velocity[2] * ObjectArray[i].Velocity[2]) < 0.01f)
                            {
                                ObjectArray[i].Velocity[0] = 0;
                                ObjectArray[i].Velocity[1] = 0;
                                ObjectArray[i].Velocity[2] = 0;
                            }
                            else
                            {
                                InjectRequestMessage injectRequestMessage = (InjectRequestMessage)MessageFactory.Current.ReserveMessage(typeof(InjectRequestMessage));
                                injectRequestMessage.ObjectFragment.OwnerId              = ParticipantId;
                                injectRequestMessage.ObjectFragment.ObjectId             = ObjectArray[i].ObjectId;
                                injectRequestMessage.ObjectFragment.ObjectName           = ObjectArray[i].ObjectName;
                                injectRequestMessage.ObjectFragment.TypeId               = TypeId;
                                injectRequestMessage.ObjectFragment.TypeName             = "TestType";
                                injectRequestMessage.ObjectFragment.Location.X           = ObjectArray[i].Location[0];
                                injectRequestMessage.ObjectFragment.Location.Y           = ObjectArray[i].Location[1];
                                injectRequestMessage.ObjectFragment.Location.Z           = ObjectArray[i].Location[2];
                                injectRequestMessage.ObjectFragment.BoundingSphereRadius = ObjectArray[i].ObjectBoundingSphereRadius;
                                client.Send(injectRequestMessage);
                            }
                        }
                        lastUpdateTime = DateTime.Now;
                    }
                }
                catch (ThreadAbortException)
                {
                    break;
                }
                catch (Exception e)
                {
                    LogUtil.Error(e.ToString());
                    Thread.Sleep(1000);
                }
                Thread.Sleep(50);
            }
        }
示例#7
0
        private void Process()
        {
            while (!isExitRequested)
            {
                try
                {
                    client.Process();

                    if (client.IsConnected && DateTime.Now.Subtract(lastUpdateTime).TotalMilliseconds > 500 && isInjected)
                    {
                        for (int i = 0; i < NumberOfObjects; i++)
                        {
                            Objects[i].OrbitAngle += Objects[i].OrbitAngularVelocity * ((float)DateTime.Now.Subtract(lastUpdateTime).TotalMilliseconds) / 1000f;
                        }
                    }


                    if (((DateTime.Now.Subtract(lastInjectEjectTime).TotalSeconds > 5 && isInjected) || (DateTime.Now.Subtract(lastInjectEjectTime).TotalSeconds > 1 && !isInjected)) && client.IsConnected)
                    {
                        if (!isInjected)
                        {
                            for (int i = 0; i < NumberOfObjects; i++)
                            {
                                InjectRequestMessage injectRequestMessage = (InjectRequestMessage)MessageFactory.Current.ReserveMessage(typeof(InjectRequestMessage));
                                injectRequestMessage.ObjectFragment.OwnerId              = ParticipantId;
                                injectRequestMessage.ObjectFragment.ObjectId             = Objects[i].ObjectId;
                                injectRequestMessage.ObjectFragment.ObjectName           = Objects[i].ObjectName;
                                injectRequestMessage.ObjectFragment.TypeId               = TypeId;
                                injectRequestMessage.ObjectFragment.TypeName             = "TestType";
                                injectRequestMessage.ObjectFragment.Location.X           = (float)(Objects[i].OrbitRadius * Math.Cos(Objects[i].OrbitAngle));
                                injectRequestMessage.ObjectFragment.Location.Y           = 0;
                                injectRequestMessage.ObjectFragment.Location.Z           = (float)(Objects[i].OrbitRadius * Math.Sin(Objects[i].OrbitAngle));
                                injectRequestMessage.ObjectFragment.BoundingSphereRadius = 1;
                                client.Send(injectRequestMessage);

                                if (i % 10 == 9)
                                {
                                    client.Process();
                                    Thread.Sleep(1);
                                }
                            }
                            isInjected = true;
                        }
                        else
                        {
                            for (int i = 0; i < NumberOfObjects; i++)
                            {
                                EjectRequestMessage ejectRequestMessage = (EjectRequestMessage)MessageFactory.Current.ReserveMessage(typeof(EjectRequestMessage));
                                ejectRequestMessage.ObjectId = Objects[i].ObjectId;
                                client.Send(ejectRequestMessage);

                                if (i % 10 == 9)
                                {
                                    client.Process();
                                    Thread.Sleep(1);
                                }
                            }
                            isInjected = false;
                        }
                        lastInjectEjectTime = DateTime.Now;
                    }
                    else
                    {
                        if (!client.IsConnecting && !client.IsConnected && !isExitRequested)
                        {
                            client.Connect(serverAddress, serverPort, bubbleId, "", location, identityProviderUrl, participantName, participantPassphrase, Guid.Empty, false);
                        }
                    }

                    if (client.IsConnected && DateTime.Now.Subtract(lastUpdateTime).TotalMilliseconds > 500 && isInjected)
                    {
                        for (int i = 0; i < NumberOfObjects; i++)
                        {
                            InjectRequestMessage injectRequestMessage = (InjectRequestMessage)MessageFactory.Current.ReserveMessage(typeof(InjectRequestMessage));
                            injectRequestMessage.ObjectFragment.OwnerId              = ParticipantId;
                            injectRequestMessage.ObjectFragment.ObjectId             = Objects[i].ObjectId;
                            injectRequestMessage.ObjectFragment.ObjectName           = Objects[i].ObjectName;
                            injectRequestMessage.ObjectFragment.TypeId               = TypeId;
                            injectRequestMessage.ObjectFragment.TypeName             = "TestType";
                            injectRequestMessage.ObjectFragment.Location.X           = (float)(Objects[i].OrbitRadius * Math.Cos(Objects[i].OrbitAngle));
                            injectRequestMessage.ObjectFragment.Location.Y           = 0;
                            injectRequestMessage.ObjectFragment.Location.Z           = (float)(Objects[i].OrbitRadius * Math.Sin(Objects[i].OrbitAngle));
                            injectRequestMessage.ObjectFragment.BoundingSphereRadius = 1;
                            client.Send(injectRequestMessage);
                        }
                        lastUpdateTime = DateTime.Now;
                    }
                }
                catch (ThreadAbortException)
                {
                    break;
                }
                catch (Exception e)
                {
                    LogUtil.Error(e.ToString());
                    Thread.Sleep(1000);
                }
                Thread.Sleep(50);
            }
        }
        private void LoadReferenceMessages()
        {
            udpClient = new UdpClient(UdpClientPort);

            // Control messages
            {
                AcknowledgeMessage originalMessage = new AcknowledgeMessage();
                originalMessage.MessageId = 1;
                originalMessage.AddPacketId(1);
                originalMessage.AddPacketId(2);
                originalMessage.AddPacketId(3);
                originalMessage.AddPacketId(4);
                originalMessage.AddPacketId(5);
                SerializeReferenceMessage(originalMessage);
            }
            {
                AttachRequestMessage originalMessage = new AttachRequestMessage();
                originalMessage.MessageId      = 1;
                originalMessage.TargetBubbleId = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.SourceBubbleFragment.BubbleId              = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.SourceBubbleFragment.BubbleName            = "TestBubble1";
                originalMessage.SourceBubbleFragment.BubbleAssetCacheUrl   = "TestCloudUrl";
                originalMessage.SourceBubbleFragment.BubbleAddress         = "TestBubbleAddress";
                originalMessage.SourceBubbleFragment.BubblePort            = 1;
                originalMessage.SourceBubbleFragment.BubbleCenter.X        = 2;
                originalMessage.SourceBubbleFragment.BubbleCenter.Y        = 3;
                originalMessage.SourceBubbleFragment.BubbleCenter.Z        = 4;
                originalMessage.SourceBubbleFragment.BubbleRange           = 5;
                originalMessage.SourceBubbleFragment.BubblePerceptionRange = 6;
                originalMessage.SourceBubbleFragment.BubbleRealTime        = 7;
                originalMessage.ProgramName            = "TestProgramName";
                originalMessage.ProgramMajorVersion    = 1;
                originalMessage.ProgramMinorVersion    = 2;
                originalMessage.ProtocolMajorVersion   = 3;
                originalMessage.ProtocolMinorVersion   = 4;
                originalMessage.ProtocolSourceRevision = 5;
                SerializeReferenceMessage(originalMessage);
            }
            {
                AttachResponseMessage originalMessage = new AttachResponseMessage();
                originalMessage.MessageId        = 1;
                originalMessage.RequestMessageId = 1;
                originalMessage.FailureCode      = 2;
                originalMessage.TargetBubbleFragment.BubbleId              = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.TargetBubbleFragment.BubbleName            = "TestBubble1";
                originalMessage.TargetBubbleFragment.BubbleAssetCacheUrl   = "TestCloudUrl";
                originalMessage.TargetBubbleFragment.BubbleAddress         = "TestBubbleAddress";
                originalMessage.TargetBubbleFragment.BubblePort            = 1;
                originalMessage.TargetBubbleFragment.BubbleCenter.X        = 2;
                originalMessage.TargetBubbleFragment.BubbleCenter.Y        = 3;
                originalMessage.TargetBubbleFragment.BubbleCenter.Z        = 4;
                originalMessage.TargetBubbleFragment.BubbleRange           = 5;
                originalMessage.TargetBubbleFragment.BubblePerceptionRange = 6;
                originalMessage.TargetBubbleFragment.BubbleRealTime        = 7;
                originalMessage.ProgramName            = "TestProgramName";
                originalMessage.ProgramMajorVersion    = 1;
                originalMessage.ProgramMinorVersion    = 2;
                originalMessage.ProtocolMajorVersion   = 3;
                originalMessage.ProtocolMinorVersion   = 4;
                originalMessage.ProtocolSourceRevision = 5;
                SerializeReferenceMessage(originalMessage);
            }
            {
                ChallengeRequestMessage originalMessage = new ChallengeRequestMessage();
                originalMessage.MessageId = 1;
                for (int i = 0; i < originalMessage.ChallengeRequestBytes.Length; i++)
                {
                    originalMessage.ChallengeRequestBytes[i] = (byte)i;
                }
                SerializeReferenceMessage(originalMessage);
            }
            {
                ChallengeResponseMessage originalMessage = new ChallengeResponseMessage();
                originalMessage.MessageId = 1;
                for (int i = 0; i < originalMessage.ChallengeResponseBytes.Length; i++)
                {
                    originalMessage.ChallengeResponseBytes[i] = (byte)i;
                }
                SerializeReferenceMessage(originalMessage);
            }
            {
                DetachRequestMessage originalMessage = new DetachRequestMessage();
                originalMessage.MessageId = 1;
                SerializeReferenceMessage(originalMessage);
            }
            {
                DetachResponseMessage originalMessage = new DetachResponseMessage();
                originalMessage.MessageId        = 1;
                originalMessage.RequestMessageId = 1;
                originalMessage.FailureCode      = 2;
                SerializeReferenceMessage(originalMessage);
            }
            {
                JoinRequestMessage originalMessage = new JoinRequestMessage();
                originalMessage.MessageId              = 1;
                originalMessage.BubbleId               = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.BubbleName             = "TestBubbleName";
                originalMessage.LocationName           = "TestLocation";
                originalMessage.IdentityProviderUrl    = "IdentityProviderUrl";
                originalMessage.ParticipantIdentifier  = "TestParticipantName";
                originalMessage.ParticipantSecret      = "TestParticipantPassphrase";
                originalMessage.ParticipantRealTime    = 10;
                originalMessage.ProgramName            = "TestProgramName";
                originalMessage.ProgramMajorVersion    = 1;
                originalMessage.ProgramMinorVersion    = 2;
                originalMessage.ProtocolMajorVersion   = 3;
                originalMessage.ProtocolMinorVersion   = 4;
                originalMessage.ProtocolSourceRevision = 5;
                SerializeReferenceMessage(originalMessage);
            }
            {
                JoinResponseMessage originalMessage = new JoinResponseMessage();
                originalMessage.MessageId              = 1;
                originalMessage.RequestMessageId       = 1;
                originalMessage.FailureCode            = 2;
                originalMessage.BubbleId               = Guid.Empty;
                originalMessage.ParticipantId          = Guid.Empty;
                originalMessage.AvatarId               = Guid.Empty;
                originalMessage.BubbleName             = "TestBubbleName";
                originalMessage.BubbleAssetCacheUrl    = "TestBubbleAssetCacheUrl";
                originalMessage.BubbleRange            = 3;
                originalMessage.BubblePerceptionRange  = 4;
                originalMessage.BubbleRealTime         = 5;
                originalMessage.ProgramName            = "TestProgramName";
                originalMessage.ProgramMajorVersion    = 6;
                originalMessage.ProgramMinorVersion    = 7;
                originalMessage.ProtocolMajorVersion   = 8;
                originalMessage.ProtocolMinorVersion   = 9;
                originalMessage.ProtocolSourceRevision = 10;
                SerializeReferenceMessage(originalMessage);
            }
            {
                KeepaliveMessage originalMessage = new KeepaliveMessage();
                originalMessage.MessageId = 1;
                SerializeReferenceMessage(originalMessage);
            }
            {
                LeaveRequestMessage originalMessage = new LeaveRequestMessage();
                originalMessage.MessageId = 1;
                SerializeReferenceMessage(originalMessage);
            }
            {
                LeaveResponseMessage originalMessage = new LeaveResponseMessage();
                originalMessage.MessageId        = 1;
                originalMessage.RequestMessageId = 1;
                originalMessage.FailureCode      = 2;
                SerializeReferenceMessage(originalMessage);
            }
            {
                ListBubblesRequest originalMessage = new ListBubblesRequest();
                originalMessage.MessageId = 1;
                originalMessage.ListType  = ListBubblesRequest.ListTypeHosted;
                SerializeReferenceMessage(originalMessage);
            }
            {
                ListBubblesResponse originalMessage = new ListBubblesResponse();
                originalMessage.MessageId = 1;
                {
                    BubbleFragment bubbleEntry = new BubbleFragment();
                    bubbleEntry.BubbleId              = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                    bubbleEntry.BubbleName            = "TestBubble1";
                    bubbleEntry.BubbleAssetCacheUrl   = "TestCloudUrl";
                    bubbleEntry.BubbleAddress         = "TestBubbleAddress";
                    bubbleEntry.BubblePort            = 1;
                    bubbleEntry.BubbleCenter.X        = 2;
                    bubbleEntry.BubbleCenter.Y        = 3;
                    bubbleEntry.BubbleCenter.Z        = 4;
                    bubbleEntry.BubbleRange           = 5;
                    bubbleEntry.BubblePerceptionRange = 6;
                    bubbleEntry.BubbleRealTime        = 7;
                    originalMessage.AddBubbleFragment(bubbleEntry);
                }
                {
                    BubbleFragment bubbleEntry = new BubbleFragment();
                    bubbleEntry.BubbleId              = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                    bubbleEntry.BubbleName            = "TestBubble2";
                    bubbleEntry.BubbleAssetCacheUrl   = "TestCloudUrl";
                    bubbleEntry.BubbleAddress         = "TestBubbleAddress";
                    bubbleEntry.BubblePort            = 1;
                    bubbleEntry.BubbleCenter.X        = 2;
                    bubbleEntry.BubbleCenter.Y        = 3;
                    bubbleEntry.BubbleCenter.Z        = 4;
                    bubbleEntry.BubbleRange           = 5;
                    bubbleEntry.BubblePerceptionRange = 6;
                    bubbleEntry.BubbleRealTime        = 7;
                    originalMessage.AddBubbleFragment(bubbleEntry);
                }
                {
                    BubbleFragment bubbleEntry = new BubbleFragment();
                    bubbleEntry.BubbleId              = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                    bubbleEntry.BubbleName            = "TestBubble3";
                    bubbleEntry.BubbleAssetCacheUrl   = "TestCloudUrl";
                    bubbleEntry.BubbleAddress         = "TestBubbleAddress";
                    bubbleEntry.BubblePort            = 1;
                    bubbleEntry.BubbleCenter.X        = 2;
                    bubbleEntry.BubbleCenter.Y        = 3;
                    bubbleEntry.BubbleCenter.Z        = 4;
                    bubbleEntry.BubbleRange           = 5;
                    bubbleEntry.BubblePerceptionRange = 6;
                    bubbleEntry.BubbleRealTime        = 7;
                    originalMessage.AddBubbleFragment(bubbleEntry);
                }
                {
                    BubbleFragment bubbleEntry = new BubbleFragment();
                    bubbleEntry.BubbleId              = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                    bubbleEntry.BubbleName            = "TestBubble4";
                    bubbleEntry.BubbleAssetCacheUrl   = "TestCloudUrl";
                    bubbleEntry.BubbleAddress         = "TestBubbleAddress";
                    bubbleEntry.BubblePort            = 1;
                    bubbleEntry.BubbleCenter.X        = 2;
                    bubbleEntry.BubbleCenter.Y        = 3;
                    bubbleEntry.BubbleCenter.Z        = 4;
                    bubbleEntry.BubbleRange           = 5;
                    bubbleEntry.BubblePerceptionRange = 6;
                    bubbleEntry.BubbleRealTime        = 7;
                    originalMessage.AddBubbleFragment(bubbleEntry);
                }
                {
                    BubbleFragment bubbleEntry = new BubbleFragment();
                    bubbleEntry.BubbleId              = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                    bubbleEntry.BubbleName            = "TestBubble5";
                    bubbleEntry.BubbleAssetCacheUrl   = "TestCloudUrl";
                    bubbleEntry.BubbleAddress         = "TestBubbleAddress";
                    bubbleEntry.BubblePort            = 1;
                    bubbleEntry.BubbleCenter.X        = 2;
                    bubbleEntry.BubbleCenter.Y        = 3;
                    bubbleEntry.BubbleCenter.Z        = 4;
                    bubbleEntry.BubbleRange           = 5;
                    bubbleEntry.BubblePerceptionRange = 6;
                    bubbleEntry.BubbleRealTime        = 7;
                    originalMessage.AddBubbleFragment(bubbleEntry);
                }
                SerializeReferenceMessage(originalMessage);
            }
            {
                ThrottleMessage originalMessage = new ThrottleMessage();
                originalMessage.MessageId      = 1;
                originalMessage.BytesPerSecond = 10000;
                SerializeReferenceMessage(originalMessage);
            }

            // Command messages
            {
                EjectRequestMessage originalMessage = new EjectRequestMessage();
                originalMessage.MessageId = 1;
                originalMessage.ObjectId  = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                SerializeReferenceMessage(originalMessage);
            }
            {
                EjectResponseMessage originalMessage = new EjectResponseMessage();
                originalMessage.MessageId        = 1;
                originalMessage.RequestMessageId = 1;
                originalMessage.FailureCode      = 2;
                SerializeReferenceMessage(originalMessage);
            }
            {
                ExamineRequestMessage originalMessage = new ExamineRequestMessage();
                originalMessage.MessageId   = 1;
                originalMessage.ObjectId    = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectIndex = 1;
                SerializeReferenceMessage(originalMessage);
            }
            {
                ExamineResponseMessage originalMessage = new ExamineResponseMessage();
                originalMessage.MessageId                            = 1;
                originalMessage.RequestMessageId                     = 1;
                originalMessage.FailureCode                          = 2;
                originalMessage.ObjectFragment.ObjectId              = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.ObjectIndex           = 1;
                originalMessage.ObjectFragment.TypeId                = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.ObjectName            = "TestObjectName";
                originalMessage.ObjectFragment.TypeName              = "TestTypeName";
                originalMessage.ObjectFragment.OwnerId               = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.Location.X            = 1; originalMessage.ObjectFragment.Location.Y = 2; originalMessage.ObjectFragment.Location.Z = 3;
                originalMessage.ObjectFragment.Velocity.X            = 4; originalMessage.ObjectFragment.Velocity.Y = 5; originalMessage.ObjectFragment.Velocity.Z = 6;
                originalMessage.ObjectFragment.Acceleration.X        = 7; originalMessage.ObjectFragment.Acceleration.Y = 8; originalMessage.ObjectFragment.Acceleration.Z = 9;
                originalMessage.ObjectFragment.Orientation.X         = 10; originalMessage.ObjectFragment.Orientation.Y = 11; originalMessage.ObjectFragment.Orientation.Z = 12; originalMessage.ObjectFragment.Orientation.W = 13;
                originalMessage.ObjectFragment.AngularVelocity.X     = 14; originalMessage.ObjectFragment.AngularVelocity.Y = 15; originalMessage.ObjectFragment.AngularVelocity.Z = 16; originalMessage.ObjectFragment.AngularVelocity.W = 17;
                originalMessage.ObjectFragment.AngularAcceleration.X = 18; originalMessage.ObjectFragment.AngularAcceleration.Y = 19; originalMessage.ObjectFragment.AngularAcceleration.Z = 20; originalMessage.ObjectFragment.AngularAcceleration.W = 21;
                originalMessage.ObjectFragment.BoundingSphereRadius  = 22;
                originalMessage.ObjectFragment.Mass                  = 23;
                originalMessage.ObjectFragment.ExtensionDialect      = "TEST";
                originalMessage.ObjectFragment.SetExtensionData(UTF8Encoding.UTF8.GetBytes(
                                                                    "1234567890123456789012345678901234567890"));
                SerializeReferenceMessage(originalMessage);
            }
            {
                HandoverRequestMessage originalMessage = new HandoverRequestMessage();
                originalMessage.MessageId                            = 1;
                originalMessage.SourceBubbleId                       = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.TargetBubbleId                       = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.ObjectId              = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.ObjectIndex           = 1;
                originalMessage.ObjectFragment.TypeId                = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.ObjectName            = "TestObjectName";
                originalMessage.ObjectFragment.TypeName              = "TestTypeName";
                originalMessage.ObjectFragment.OwnerId               = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.Location.X            = 1; originalMessage.ObjectFragment.Location.Y = 2; originalMessage.ObjectFragment.Location.Z = 3;
                originalMessage.ObjectFragment.Velocity.X            = 4; originalMessage.ObjectFragment.Velocity.Y = 5; originalMessage.ObjectFragment.Velocity.Z = 6;
                originalMessage.ObjectFragment.Acceleration.X        = 7; originalMessage.ObjectFragment.Acceleration.Y = 8; originalMessage.ObjectFragment.Acceleration.Z = 9;
                originalMessage.ObjectFragment.Orientation.X         = 10; originalMessage.ObjectFragment.Orientation.Y = 11; originalMessage.ObjectFragment.Orientation.Z = 12; originalMessage.ObjectFragment.Orientation.W = 13;
                originalMessage.ObjectFragment.AngularVelocity.X     = 14; originalMessage.ObjectFragment.AngularVelocity.Y = 15; originalMessage.ObjectFragment.AngularVelocity.Z = 16; originalMessage.ObjectFragment.AngularVelocity.W = 17;
                originalMessage.ObjectFragment.AngularAcceleration.X = 18; originalMessage.ObjectFragment.AngularAcceleration.Y = 19; originalMessage.ObjectFragment.AngularAcceleration.Z = 20; originalMessage.ObjectFragment.AngularAcceleration.W = 21;
                originalMessage.ObjectFragment.BoundingSphereRadius  = 22;
                originalMessage.ObjectFragment.Mass                  = 23;
                originalMessage.ObjectFragment.ExtensionDialect      = "TEST";
                originalMessage.ObjectFragment.SetExtensionData(UTF8Encoding.UTF8.GetBytes(
                                                                    "1234567890123"));
                SerializeReferenceMessage(originalMessage);
            }
            {
                HandoverResponseMessage originalMessage = new HandoverResponseMessage();
                originalMessage.MessageId        = 1;
                originalMessage.RequestMessageId = 1;
                originalMessage.FailureCode      = 2;
                SerializeReferenceMessage(originalMessage);
            }
            {
                InjectRequestMessage originalMessage = new InjectRequestMessage();
                originalMessage.MessageId = 1;
                originalMessage.ObjectFragment.ObjectId              = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.ObjectIndex           = 1;
                originalMessage.ObjectFragment.TypeId                = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.ObjectName            = "TestObjectName";
                originalMessage.ObjectFragment.TypeName              = "TestTypeName";
                originalMessage.ObjectFragment.OwnerId               = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.Location.X            = 1; originalMessage.ObjectFragment.Location.Y = 2; originalMessage.ObjectFragment.Location.Z = 3;
                originalMessage.ObjectFragment.Velocity.X            = 4; originalMessage.ObjectFragment.Velocity.Y = 5; originalMessage.ObjectFragment.Velocity.Z = 6;
                originalMessage.ObjectFragment.Acceleration.X        = 7; originalMessage.ObjectFragment.Acceleration.Y = 8; originalMessage.ObjectFragment.Acceleration.Z = 9;
                originalMessage.ObjectFragment.Orientation.X         = 10; originalMessage.ObjectFragment.Orientation.Y = 11; originalMessage.ObjectFragment.Orientation.Z = 12; originalMessage.ObjectFragment.Orientation.W = 13;
                originalMessage.ObjectFragment.AngularVelocity.X     = 14; originalMessage.ObjectFragment.AngularVelocity.Y = 15; originalMessage.ObjectFragment.AngularVelocity.Z = 16; originalMessage.ObjectFragment.AngularVelocity.W = 17;
                originalMessage.ObjectFragment.AngularAcceleration.X = 18; originalMessage.ObjectFragment.AngularAcceleration.Y = 19; originalMessage.ObjectFragment.AngularAcceleration.Z = 20; originalMessage.ObjectFragment.AngularAcceleration.W = 21;
                originalMessage.ObjectFragment.BoundingSphereRadius  = 22;
                originalMessage.ObjectFragment.Mass                         = 23;
                originalMessage.ObjectFragment.ExtensionDialect             = "TEST";
                originalMessage.ObjectFragment.ExtensionDialectMajorVersion = 24;
                originalMessage.ObjectFragment.ExtensionDialectMinorVersion = 25;
                originalMessage.ObjectFragment.SetExtensionData(UTF8Encoding.UTF8.GetBytes(
                                                                    "123456789012345678901234567890123456789012345"));
                SerializeReferenceMessage(originalMessage);
            }
            {
                InjectResponseMessage originalMessage = new InjectResponseMessage();
                originalMessage.MessageId        = 1;
                originalMessage.RequestMessageId = 1;
                originalMessage.FailureCode      = 2;
                SerializeReferenceMessage(originalMessage);
            }
            {
                InteractRequestMessage originalMessage = new InteractRequestMessage();
                originalMessage.MessageId = 1;
                originalMessage.InteractionFragment.InteractionName     = "TestInteractionName";
                originalMessage.InteractionFragment.SourceParticipantId = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.InteractionFragment.SourceObjectId      = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.InteractionFragment.TargetParticipantId = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.InteractionFragment.TargetObjectId      = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.InteractionFragment.ExtensionDialect    = "TEST";
                originalMessage.SetInteractionPayloadData(UTF8Encoding.UTF8.GetBytes(
                                                              "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" +
                                                              "1234567890123456789012345678901234567890123456789012345678901"));
                SerializeReferenceMessage(originalMessage);
            }
            {
                InteractResponseMessage originalMessage = new InteractResponseMessage();
                originalMessage.MessageId        = 1;
                originalMessage.RequestMessageId = 1;
                originalMessage.FailureCode      = 2;
                originalMessage.InteractionFragment.InteractionName     = "TestInteractionName";
                originalMessage.InteractionFragment.SourceParticipantId = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.InteractionFragment.SourceObjectId      = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.InteractionFragment.TargetParticipantId = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.InteractionFragment.TargetObjectId      = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.InteractionFragment.ExtensionDialect    = "TEST";
                originalMessage.SetInteractionPayloadData(UTF8Encoding.UTF8.GetBytes(
                                                              "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" +
                                                              "12345678901234567890123456789012345678901234567890123456"));
                SerializeReferenceMessage(originalMessage);
            }
            {
                ModifyRequestMessage originalMessage = new ModifyRequestMessage();
                originalMessage.MessageId = 1;
                originalMessage.ObjectFragment.ObjectId              = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.ObjectIndex           = 1;
                originalMessage.ObjectFragment.TypeId                = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.ObjectName            = "TestObjectName";
                originalMessage.ObjectFragment.TypeName              = "TestTypeName";
                originalMessage.ObjectFragment.OwnerId               = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.Location.X            = 1; originalMessage.ObjectFragment.Location.Y = 2; originalMessage.ObjectFragment.Location.Z = 3;
                originalMessage.ObjectFragment.Velocity.X            = 4; originalMessage.ObjectFragment.Velocity.Y = 5; originalMessage.ObjectFragment.Velocity.Z = 6;
                originalMessage.ObjectFragment.Acceleration.X        = 7; originalMessage.ObjectFragment.Acceleration.Y = 8; originalMessage.ObjectFragment.Acceleration.Z = 9;
                originalMessage.ObjectFragment.Orientation.X         = 10; originalMessage.ObjectFragment.Orientation.Y = 11; originalMessage.ObjectFragment.Orientation.Z = 12; originalMessage.ObjectFragment.Orientation.W = 13;
                originalMessage.ObjectFragment.AngularVelocity.X     = 14; originalMessage.ObjectFragment.AngularVelocity.Y = 15; originalMessage.ObjectFragment.AngularVelocity.Z = 16; originalMessage.ObjectFragment.AngularVelocity.W = 17;
                originalMessage.ObjectFragment.AngularAcceleration.X = 18; originalMessage.ObjectFragment.AngularAcceleration.Y = 19; originalMessage.ObjectFragment.AngularAcceleration.Z = 20; originalMessage.ObjectFragment.AngularAcceleration.W = 21;
                originalMessage.ObjectFragment.BoundingSphereRadius  = 22;
                originalMessage.ObjectFragment.Mass             = 23;
                originalMessage.ObjectFragment.ExtensionDialect = "TEST";
                originalMessage.ObjectFragment.SetExtensionData(UTF8Encoding.UTF8.GetBytes(
                                                                    "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" +
                                                                    "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" +
                                                                    "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" +
                                                                    "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678"));
                SerializeReferenceMessage(originalMessage);
            }
            {
                ModifyResponseMessage originalMessage = new ModifyResponseMessage();
                originalMessage.MessageId        = 1;
                originalMessage.RequestMessageId = 1;
                originalMessage.FailureCode      = 2;
                SerializeReferenceMessage(originalMessage);
            }

            // Event messages
            {
                ActionEventMessage originalMessage = new ActionEventMessage();
                originalMessage.MessageId = 1;
                originalMessage.ActionFragment.ActionName                   = "TestInteractionName";
                originalMessage.ActionFragment.SourceObjectId               = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ActionFragment.ObservationRadius            = 100;
                originalMessage.ActionFragment.ExtensionDialect             = "TEST";
                originalMessage.ActionFragment.ExtensionDialectMajorVersion = 1;
                originalMessage.ActionFragment.ExtensionDialectMinorVersion = 2;
                originalMessage.SetPayloadData(UTF8Encoding.UTF8.GetBytes(
                                                   "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" +
                                                   "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" +
                                                   "12345"));
                SerializeReferenceMessage(originalMessage);
            }
            {
                DisappearanceEventMessage originalMessage = new DisappearanceEventMessage();
                originalMessage.MessageId   = 1;
                originalMessage.ObjectIndex = 1;
                SerializeReferenceMessage(originalMessage);
            }
            {
                HandoverEventMessage originalMessage = new HandoverEventMessage();
                originalMessage.MessageId                            = 1;
                originalMessage.SourceBubbleId                       = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.TargetBubbleId                       = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.ObjectId              = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.ObjectIndex           = 1;
                originalMessage.ObjectFragment.TypeId                = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.ObjectName            = "TestObjectName";
                originalMessage.ObjectFragment.TypeName              = "TestTypeName";
                originalMessage.ObjectFragment.OwnerId               = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.Location.X            = 1; originalMessage.ObjectFragment.Location.Y = 2; originalMessage.ObjectFragment.Location.Z = 3;
                originalMessage.ObjectFragment.Velocity.X            = 4; originalMessage.ObjectFragment.Velocity.Y = 5; originalMessage.ObjectFragment.Velocity.Z = 6;
                originalMessage.ObjectFragment.Acceleration.X        = 7; originalMessage.ObjectFragment.Acceleration.Y = 8; originalMessage.ObjectFragment.Acceleration.Z = 9;
                originalMessage.ObjectFragment.Orientation.X         = 10; originalMessage.ObjectFragment.Orientation.Y = 11; originalMessage.ObjectFragment.Orientation.Z = 12; originalMessage.ObjectFragment.Orientation.W = 13;
                originalMessage.ObjectFragment.AngularVelocity.X     = 14; originalMessage.ObjectFragment.AngularVelocity.Y = 15; originalMessage.ObjectFragment.AngularVelocity.Z = 16; originalMessage.ObjectFragment.AngularVelocity.W = 17;
                originalMessage.ObjectFragment.AngularAcceleration.X = 18; originalMessage.ObjectFragment.AngularAcceleration.Y = 19; originalMessage.ObjectFragment.AngularAcceleration.Z = 20; originalMessage.ObjectFragment.AngularAcceleration.W = 21;
                originalMessage.ObjectFragment.BoundingSphereRadius  = 22;
                originalMessage.ObjectFragment.Mass                  = 23;
                originalMessage.ObjectFragment.ExtensionDialect      = "TEST";
                originalMessage.ObjectFragment.SetExtensionData(UTF8Encoding.UTF8.GetBytes(
                                                                    "1234567890123"));
                SerializeReferenceMessage(originalMessage);
            }
            {
                MovementEventMessage originalMessage = new MovementEventMessage();
                originalMessage.MessageId     = 1;
                originalMessage.ObjectIndex   = 1;
                originalMessage.Location.X    = 1; originalMessage.Location.Y = 2; originalMessage.Location.Z = 3;
                originalMessage.Orientation.X = 10; originalMessage.Orientation.Y = 11; originalMessage.Orientation.Z = 12; originalMessage.Orientation.W = 13;

                SerializeReferenceMessage(originalMessage);
            }
            {
                PerceptionEventMessage originalMessage = new PerceptionEventMessage();
                originalMessage.MessageId = 1;
                originalMessage.ObjectFragment.ObjectId              = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.ObjectIndex           = 1;
                originalMessage.ObjectFragment.TypeId                = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.ObjectName            = "TestObjectName";
                originalMessage.ObjectFragment.TypeName              = "TestTypeName";
                originalMessage.ObjectFragment.OwnerId               = new Guid("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
                originalMessage.ObjectFragment.Location.X            = 1; originalMessage.ObjectFragment.Location.Y = 2; originalMessage.ObjectFragment.Location.Z = 3;
                originalMessage.ObjectFragment.Velocity.X            = 4; originalMessage.ObjectFragment.Velocity.Y = 5; originalMessage.ObjectFragment.Velocity.Z = 6;
                originalMessage.ObjectFragment.Acceleration.X        = 7; originalMessage.ObjectFragment.Acceleration.Y = 8; originalMessage.ObjectFragment.Acceleration.Z = 9;
                originalMessage.ObjectFragment.Orientation.X         = 10; originalMessage.ObjectFragment.Orientation.Y = 11; originalMessage.ObjectFragment.Orientation.Z = 12; originalMessage.ObjectFragment.Orientation.W = 13;
                originalMessage.ObjectFragment.AngularVelocity.X     = 14; originalMessage.ObjectFragment.AngularVelocity.Y = 15; originalMessage.ObjectFragment.AngularVelocity.Z = 16; originalMessage.ObjectFragment.AngularVelocity.W = 17;
                originalMessage.ObjectFragment.AngularAcceleration.X = 18; originalMessage.ObjectFragment.AngularAcceleration.Y = 19; originalMessage.ObjectFragment.AngularAcceleration.Z = 20; originalMessage.ObjectFragment.AngularAcceleration.W = 21;
                originalMessage.ObjectFragment.BoundingSphereRadius  = 22;
                originalMessage.ObjectFragment.Mass             = 23;
                originalMessage.ObjectFragment.ExtensionDialect = "TEST";
                originalMessage.ObjectFragment.SetExtensionData(UTF8Encoding.UTF8.GetBytes(
                                                                    "123456789012345678901234567890123456789012345"));
                SerializeReferenceMessage(originalMessage);
            }
            {
                SynchronizationBeginEventMessage originalMessage = new SynchronizationBeginEventMessage();
                originalMessage.MessageId   = 1;
                originalMessage.ObjectCount = 1;
                SerializeReferenceMessage(originalMessage);
            }
            {
                SynchronizationEndEventMessage originalMessage = new SynchronizationEndEventMessage();
                originalMessage.MessageId = 1;
                SerializeReferenceMessage(originalMessage);
            }

            udpClient.Close();
            udpClient = null;
        }
        public static void Execute(string ip, int port)
        {
            log4net.Config.XmlConfigurator.Configure();

            CloudView view = null;

            try
            {
                string clientProgramName              = "ClientProgram";
                byte   clientProgramMajorVersion      = 5;
                byte   clientProgramMinorVersion      = 6;
                string participantIdentityProviderUrl = "http://test.identityprovider";
                string participantName       = "TestParticipantName";
                string participantPassphrase = "TestParticipantPassphrase";
                Guid   avatarId = new Guid("123DFA16-5B52-4c9f-9A09-AD7465208321");

                view = new CloudView(1000, clientProgramName, clientProgramMajorVersion, clientProgramMinorVersion);
                view.Connect(ip, port, new Guid("539DFA16-5B52-4c9f-9A09-AD746520873E"), "", "", participantIdentityProviderUrl, participantName, participantPassphrase, avatarId, true);

                for (int i = 0; i < 10; i++)
                {
                    Thread.Sleep(100);
                    view.Process();
                    if (view.IsConnected)
                    {
                        break;
                    }
                }

                if (!view.IsConnected)
                {
                    Console.WriteLine("Unable to connect server.");
                    return;
                }

                Guid   objectId                           = avatarId;
                uint   objectIndex                        = 100;
                string objectName                         = "TestObjectName";
                Guid   objectParentObjectId               = Guid.NewGuid();
                Guid   objectTypeId                       = Guid.NewGuid();
                string objectTypeName                     = "TestObjectType";
                float  objectBoundingSphereRadius         = 23;
                float  objectMass                         = 24;
                float  objectLocationX                    = 2;
                float  objectLocationY                    = 3;
                float  objectLocationZ                    = 4;
                float  modifiedObjectLocationX            = 12;
                float  modifiedObjectLocationY            = 13;
                float  modifiedObjectLocationZ            = 14;
                float  objectVelocityX                    = 5;
                float  objectVelocityY                    = 6;
                float  objectVelocityZ                    = 7;
                float  objectAccelerationX                = 8;
                float  objectAccelerationY                = 9;
                float  objectAccelerationZ                = 10;
                float  objectOrientationX                 = 11;
                float  objectOrientationY                 = 12;
                float  objectOrientationZ                 = 13;
                float  objectOrientationW                 = 14;
                float  objectAngularVelocityX             = 15;
                float  objectAngularVelocityY             = 16;
                float  objectAngularVelocityZ             = 17;
                float  objectAngularVelocityW             = 18;
                float  objectAngularAccelerationX         = 19;
                float  objectAngularAccelerationY         = 20;
                float  objectAngularAccelerationZ         = 21;
                float  objectAngularAccelerationW         = 22;
                string objectExtensionDialect             = "TEDI";
                byte   objectExtensionDialectMinorVersion = 23;
                byte   objectExtensionDialectMajorVersion = 24;
                byte[] objectExtensionData                = ASCIIEncoding.ASCII.GetBytes("012345678901234567890123456789012345678901234567890123456789");

                InjectRequestMessage injectRequestMessage = new InjectRequestMessage();
                injectRequestMessage.ObjectFragment.ObjectId                     = objectId;
                injectRequestMessage.ObjectFragment.ObjectIndex                  = objectIndex;
                injectRequestMessage.ObjectFragment.ObjectName                   = objectName;
                injectRequestMessage.ObjectFragment.TypeId                       = objectTypeId;
                injectRequestMessage.ObjectFragment.TypeName                     = objectTypeName;
                injectRequestMessage.ObjectFragment.OwnerId                      = view.ParticipantId;
                injectRequestMessage.ObjectFragment.ParentObjectId               = objectParentObjectId;
                injectRequestMessage.ObjectFragment.Mass                         = objectMass;
                injectRequestMessage.ObjectFragment.BoundingSphereRadius         = objectBoundingSphereRadius;
                injectRequestMessage.ObjectFragment.Location.X                   = objectLocationX;
                injectRequestMessage.ObjectFragment.Location.Y                   = objectLocationY;
                injectRequestMessage.ObjectFragment.Location.Z                   = objectLocationZ;
                injectRequestMessage.ObjectFragment.Velocity.X                   = objectVelocityX;
                injectRequestMessage.ObjectFragment.Velocity.Y                   = objectVelocityY;
                injectRequestMessage.ObjectFragment.Velocity.Z                   = objectVelocityZ;
                injectRequestMessage.ObjectFragment.Acceleration.X               = objectAccelerationX;
                injectRequestMessage.ObjectFragment.Acceleration.Y               = objectAccelerationY;
                injectRequestMessage.ObjectFragment.Acceleration.Z               = objectAccelerationZ;
                injectRequestMessage.ObjectFragment.Orientation.X                = objectOrientationX;
                injectRequestMessage.ObjectFragment.Orientation.Y                = objectOrientationY;
                injectRequestMessage.ObjectFragment.Orientation.Z                = objectOrientationZ;
                injectRequestMessage.ObjectFragment.Orientation.W                = objectOrientationW;
                injectRequestMessage.ObjectFragment.AngularVelocity.X            = objectAngularVelocityX;
                injectRequestMessage.ObjectFragment.AngularVelocity.Y            = objectAngularVelocityY;
                injectRequestMessage.ObjectFragment.AngularVelocity.Z            = objectAngularVelocityZ;
                injectRequestMessage.ObjectFragment.AngularVelocity.W            = objectAngularVelocityW;
                injectRequestMessage.ObjectFragment.AngularAcceleration.X        = objectAngularAccelerationX;
                injectRequestMessage.ObjectFragment.AngularAcceleration.Y        = objectAngularAccelerationY;
                injectRequestMessage.ObjectFragment.AngularAcceleration.Z        = objectAngularAccelerationZ;
                injectRequestMessage.ObjectFragment.AngularAcceleration.W        = objectAngularAccelerationW;
                injectRequestMessage.ObjectFragment.ExtensionDialect             = objectExtensionDialect;
                injectRequestMessage.ObjectFragment.ExtensionDialectMajorVersion = objectExtensionDialectMajorVersion;
                injectRequestMessage.ObjectFragment.ExtensionDialectMinorVersion = objectExtensionDialectMinorVersion;
                injectRequestMessage.ObjectFragment.SetExtensionData(objectExtensionData);
                view.InjectObject(injectRequestMessage);

                Thread.Sleep(20);
                view.Process();
                Thread.Sleep(20);
                view.Process();
                Thread.Sleep(20);
                view.Process();
                Thread.Sleep(20);
                view.Process();
                Thread.Sleep(20);
                view.Process();
                Thread.Sleep(20);
                view.Process();
                Thread.Sleep(20);
                view.Process();

                CloudObject cloudObject = view.CloudCache.GetObject(objectId);

                ModifyRequestMessage modifyRequestMessage = new ModifyRequestMessage();
                cloudObject.ToObjectFragment(modifyRequestMessage.ObjectFragment);
                modifyRequestMessage.ObjectFragment.Location.X = modifiedObjectLocationX;
                modifyRequestMessage.ObjectFragment.Location.Y = modifiedObjectLocationY;
                modifyRequestMessage.ObjectFragment.Location.Z = modifiedObjectLocationZ;
                view.ModifyObject(modifyRequestMessage);

                Thread.Sleep(100);
                view.Process();

                ExamineRequestMessage examineRequestMessage = new ExamineRequestMessage();
                examineRequestMessage.ObjectIndex = cloudObject.RemoteObjectIndex;
                view.ExamineObject(examineRequestMessage);

                Thread.Sleep(100);
                view.Process();

                InteractRequestMessage interactRequesMessage = new InteractRequestMessage();
                interactRequesMessage.InteractionFragment.SourceParticipantId          = view.ParticipantId;
                interactRequesMessage.InteractionFragment.SourceObjectId               = Guid.Empty;
                interactRequesMessage.InteractionFragment.TargetParticipantId          = Guid.Empty;
                interactRequesMessage.InteractionFragment.TargetObjectId               = objectId;
                interactRequesMessage.InteractionFragment.ExtensionDialect             = objectExtensionDialect;
                interactRequesMessage.InteractionFragment.ExtensionDialectMajorVersion = objectExtensionDialectMajorVersion;
                interactRequesMessage.InteractionFragment.ExtensionDialectMinorVersion = objectExtensionDialectMinorVersion;
                interactRequesMessage.InteractionFragment.SetExtensionData(objectExtensionData);
                view.InteractWithObject(interactRequesMessage);

                Thread.Sleep(100);
                view.Process();

                EjectRequestMessage ejectRequestMessage = new EjectRequestMessage();
                ejectRequestMessage.ObjectId = objectId;
                view.EjectObject(ejectRequestMessage);

                Thread.Sleep(100);
                view.Process();
            }
            finally
            {
                if (view != null)
                {
                    view.Disconnect();

                    while (view.Client.IsTransmitterAlive)
                    {
                        Thread.Sleep(100);
                        view.Process();
                    }
                }
            }
        }
示例#10
0
        public void MovementEvent()
        {
            CloudService serviceAlpha = new CloudService(serviceAlphaAssetCacheUrl, serviceAlphaAddress, serviceAlphaHubPort, serviceAlphaServerPort, serviceAlphaProgram, serviceAlphaProgramMajorVersion, serviceAlphaProgramMinorVersion);
            CloudBubble  bubbleOne    = new CloudBubble(bubbleOneId, bubbleOneName, bubbleOneRange, bubbleOnePerceptionRange);

            serviceAlpha.AddBubble(bubbleOne);
            bubbleOne.AddAllowedRemoteHubAddress(serviceBetaAddress);

            serviceAlpha.AddBubbleLink(bubbleOneId, bubbleTwoId, serviceBetaAddress, serviceBetaHubPort, bubbleOneTwoDeltaX, bubbleOneTwoDeltaY, bubbleOneTwoDeltaZ, true, true);

            CloudService serviceBeta = new CloudService(serviceBetaAssetCacheUrl, serviceBetaAddress, serviceBetaHubPort, serviceBetaServerPort, serviceBetaProgram, serviceBetaProgramMajorVersion, serviceBetaProgramMinorVersion);
            CloudBubble  bubbleTwo   = new CloudBubble(bubbleTwoId, bubbleTwoName, bubbleTwoRange, bubbleTwoPerceptionRange);

            bubbleTwo.AddAllowedRemoteHubAddress(serviceAlphaAddress);
            serviceBeta.AddBubble(bubbleTwo);

            CloudBubble bubbleThree = new CloudBubble(bubbleThreeId, bubbleThreeName, bubbleThreeRange, bubbleThreePerceptionRange);

            bubbleThree.AddAllowedRemoteHubAddress(serviceAlphaAddress);
            bubbleThree.AddAllowedRemoteHubAddress(serviceBetaAddress);
            serviceBeta.AddBubble(bubbleThree);

            serviceBeta.AddBubbleLink(bubbleTwoId, bubbleThreeId, serviceBetaAddress, serviceBetaHubPort, bubbleTwoThreeDeltaX, bubbleTwoThreeDeltaY, bubbleTwoThreeDeltaZ, true, true);

            serviceAlpha.Startup(false);
            serviceBeta.Startup(false);

            CloudView viewOne = new CloudView(1000, clientProgramName, clientProgramMajorVersion, clientProgramMinorVersion);

            viewOne.Connect(serviceAlphaAddress, serviceAlphaServerPort, bubbleOneId, "", "", participantIdentityProviderUrl, participantNameOne, participantPassphraseOne, objectId, false);

            CloudView viewTwo = new CloudView(1000, clientProgramName, clientProgramMajorVersion, clientProgramMinorVersion);

            viewTwo.Connect(serviceBetaAddress, serviceBetaServerPort, bubbleThreeId, "", "", participantIdentityProviderUrl, participantNameTwo, participantPassphraseTwo, objectId, false);

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();

            Assert.IsTrue(viewOne.IsConnected);
            Assert.IsTrue(viewTwo.IsConnected);

            InjectRequestMessage injectRequestMessage = new InjectRequestMessage();

            injectRequestMessage.ObjectFragment.ObjectId                     = objectId;
            injectRequestMessage.ObjectFragment.ObjectIndex                  = objectIndex;
            injectRequestMessage.ObjectFragment.ObjectName                   = objectName;
            injectRequestMessage.ObjectFragment.TypeId                       = objectTypeId;
            injectRequestMessage.ObjectFragment.TypeName                     = objectTypeName;
            injectRequestMessage.ObjectFragment.OwnerId                      = viewOne.ParticipantId;
            injectRequestMessage.ObjectFragment.ParentObjectId               = objectParentObjectId;
            injectRequestMessage.ObjectFragment.Mass                         = objectMass;
            injectRequestMessage.ObjectFragment.BoundingSphereRadius         = objectBoundingSphereRadius;
            injectRequestMessage.ObjectFragment.Location.X                   = objectLocationX;
            injectRequestMessage.ObjectFragment.Location.Y                   = objectLocationY;
            injectRequestMessage.ObjectFragment.Location.Z                   = objectLocationZ;
            injectRequestMessage.ObjectFragment.Velocity.X                   = objectVelocityX;
            injectRequestMessage.ObjectFragment.Velocity.Y                   = objectVelocityY;
            injectRequestMessage.ObjectFragment.Velocity.Z                   = objectVelocityZ;
            injectRequestMessage.ObjectFragment.Acceleration.X               = objectAccelerationX;
            injectRequestMessage.ObjectFragment.Acceleration.Y               = objectAccelerationY;
            injectRequestMessage.ObjectFragment.Acceleration.Z               = objectAccelerationZ;
            injectRequestMessage.ObjectFragment.Orientation.X                = objectOrientationX;
            injectRequestMessage.ObjectFragment.Orientation.Y                = objectOrientationY;
            injectRequestMessage.ObjectFragment.Orientation.Z                = objectOrientationZ;
            injectRequestMessage.ObjectFragment.Orientation.W                = objectOrientationW;
            injectRequestMessage.ObjectFragment.AngularVelocity.X            = objectAngularVelocityX;
            injectRequestMessage.ObjectFragment.AngularVelocity.Y            = objectAngularVelocityY;
            injectRequestMessage.ObjectFragment.AngularVelocity.Z            = objectAngularVelocityZ;
            injectRequestMessage.ObjectFragment.AngularVelocity.W            = objectAngularVelocityW;
            injectRequestMessage.ObjectFragment.AngularAcceleration.X        = objectAngularAccelerationX;
            injectRequestMessage.ObjectFragment.AngularAcceleration.Y        = objectAngularAccelerationY;
            injectRequestMessage.ObjectFragment.AngularAcceleration.Z        = objectAngularAccelerationZ;
            injectRequestMessage.ObjectFragment.AngularAcceleration.W        = objectAngularAccelerationW;
            injectRequestMessage.ObjectFragment.ExtensionDialect             = objectExtensionDialect;
            injectRequestMessage.ObjectFragment.ExtensionDialectMajorVersion = objectExtensionDialectMajorVersion;
            injectRequestMessage.ObjectFragment.ExtensionDialectMinorVersion = objectExtensionDialectMinorVersion;
            injectRequestMessage.ObjectFragment.SetExtensionData(objectExtensionData);
            viewOne.InjectObject(injectRequestMessage);

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();


            CloudObject bubbleOneCloudObject = bubbleOne.CloudCache.GetObject(objectId);

            Assert.IsNotNull(bubbleOneCloudObject);

            CloudObject bubbleTwoCloudObject = bubbleTwo.CloudCache.GetObject(objectId);

            Assert.IsNotNull(bubbleTwoCloudObject);

            CloudObject bubbleThreeCloudObject = bubbleThree.CloudCache.GetObject(objectId);

            Assert.IsNotNull(bubbleThreeCloudObject);

            CloudObject viewOneCloudObject = viewOne.CloudCache.GetObject(objectId);

            Assert.IsNotNull(viewOneCloudObject);

            CloudObject viewTwoCloudObject = viewTwo.CloudCache.GetObject(objectId);

            Assert.IsNotNull(viewTwoCloudObject);

            MovementEventMessage movement = new MovementEventMessage();

            movement.ObjectIndex   = viewOneCloudObject.LocalObjectIndex;
            movement.Location.X    = modifiedObjectLocationX;
            movement.Location.Y    = modifiedObjectLocationY;
            movement.Location.Z    = modifiedObjectLocationZ;
            movement.Orientation.X = objectOrientationX;
            movement.Orientation.Y = objectOrientationY;
            movement.Orientation.Z = objectOrientationZ;
            movement.Orientation.W = objectOrientationW;

            viewOne.MoveObject(movement);

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();

            Assert.AreEqual(modifiedObjectLocationX - bubbleOneTwoDeltaX - bubbleTwoThreeDeltaX, bubbleThreeCloudObject.Location.X);
            Assert.AreEqual(modifiedObjectLocationY - bubbleOneTwoDeltaY - bubbleTwoThreeDeltaY, bubbleThreeCloudObject.Location.Y);
            Assert.AreEqual(modifiedObjectLocationZ - bubbleOneTwoDeltaZ - bubbleTwoThreeDeltaZ, bubbleThreeCloudObject.Location.Z);
            Assert.AreEqual(objectOrientationX, bubbleThreeCloudObject.Orientation.X);
            Assert.AreEqual(objectOrientationY, bubbleThreeCloudObject.Orientation.Y);
            Assert.AreEqual(objectOrientationZ, bubbleThreeCloudObject.Orientation.Z);
            Assert.AreEqual(objectOrientationW, bubbleThreeCloudObject.Orientation.W);

            EjectRequestMessage ejectRequestMessage = new EjectRequestMessage();

            ejectRequestMessage.ObjectId = objectId;
            viewOne.EjectObject(ejectRequestMessage);

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();

            Assert.IsNull(bubbleOne.CloudCache.GetObject(objectId));
            Assert.IsNull(bubbleTwo.CloudCache.GetObject(objectId));
            Assert.IsNull(bubbleThree.CloudCache.GetObject(objectId));
            Assert.IsNull(viewOne.CloudCache.GetObject(objectId));
            Assert.IsNull(viewTwo.CloudCache.GetObject(objectId));

            viewOne.Disconnect();
            viewTwo.Disconnect();

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();

            serviceAlpha.Shutdown();
            serviceBeta.Shutdown();
        }
示例#11
0
        public void ActionEvent()
        {
            CloudService serviceAlpha = new CloudService(serviceAlphaAssetCacheUrl, serviceAlphaAddress, serviceAlphaHubPort, serviceAlphaServerPort, serviceAlphaProgram, serviceAlphaProgramMajorVersion, serviceAlphaProgramMinorVersion);
            CloudBubble  bubbleOne    = new CloudBubble(bubbleOneId, bubbleOneName, bubbleOneRange, bubbleOnePerceptionRange);

            serviceAlpha.AddBubble(bubbleOne);
            bubbleOne.AddAllowedRemoteHubAddress(serviceBetaAddress);

            serviceAlpha.AddBubbleLink(bubbleOneId, bubbleTwoId, serviceBetaAddress, serviceBetaHubPort, bubbleOneTwoDeltaX, bubbleOneTwoDeltaY, bubbleOneTwoDeltaZ, true, true);

            CloudService serviceBeta = new CloudService(serviceBetaAssetCacheUrl, serviceBetaAddress, serviceBetaHubPort, serviceBetaServerPort, serviceBetaProgram, serviceBetaProgramMajorVersion, serviceBetaProgramMinorVersion);
            CloudBubble  bubbleTwo   = new CloudBubble(bubbleTwoId, bubbleTwoName, bubbleTwoRange, bubbleTwoPerceptionRange);

            bubbleTwo.AddAllowedRemoteHubAddress(serviceAlphaAddress);
            serviceBeta.AddBubble(bubbleTwo);

            CloudBubble bubbleThree = new CloudBubble(bubbleThreeId, bubbleThreeName, bubbleThreeRange, bubbleThreePerceptionRange);

            bubbleThree.AddAllowedRemoteHubAddress(serviceAlphaAddress);
            bubbleThree.AddAllowedRemoteHubAddress(serviceBetaAddress);
            serviceBeta.AddBubble(bubbleThree);

            serviceBeta.AddBubbleLink(bubbleTwoId, bubbleThreeId, serviceBetaAddress, serviceBetaHubPort, bubbleTwoThreeDeltaX, bubbleTwoThreeDeltaY, bubbleTwoThreeDeltaZ, true, true);

            serviceAlpha.Startup(false);
            serviceBeta.Startup(false);

            CloudView viewOne = new CloudView(1000, clientProgramName, clientProgramMajorVersion, clientProgramMinorVersion);

            viewOne.Connect(serviceAlphaAddress, serviceAlphaServerPort, bubbleOneId, "", "", participantIdentityProviderUrl, participantNameOne, participantPassphraseOne, objectId, false);

            CloudView viewTwo = new CloudView(1000, clientProgramName, clientProgramMajorVersion, clientProgramMinorVersion);

            viewTwo.Connect(serviceBetaAddress, serviceBetaServerPort, bubbleThreeId, "", "", participantIdentityProviderUrl, participantNameTwo, participantPassphraseTwo, objectId, false);

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();

            Assert.IsTrue(viewOne.IsConnected);
            Assert.IsTrue(viewTwo.IsConnected);

            InjectRequestMessage injectRequestMessage = new InjectRequestMessage();

            injectRequestMessage.ObjectFragment.ObjectId                     = objectId;
            injectRequestMessage.ObjectFragment.ObjectIndex                  = objectIndex;
            injectRequestMessage.ObjectFragment.ObjectName                   = objectName;
            injectRequestMessage.ObjectFragment.TypeId                       = objectTypeId;
            injectRequestMessage.ObjectFragment.TypeName                     = objectTypeName;
            injectRequestMessage.ObjectFragment.OwnerId                      = viewOne.ParticipantId;
            injectRequestMessage.ObjectFragment.ParentObjectId               = objectParentObjectId;
            injectRequestMessage.ObjectFragment.Mass                         = objectMass;
            injectRequestMessage.ObjectFragment.BoundingSphereRadius         = objectBoundingSphereRadius;
            injectRequestMessage.ObjectFragment.Location.X                   = objectLocationX;
            injectRequestMessage.ObjectFragment.Location.Y                   = objectLocationY;
            injectRequestMessage.ObjectFragment.Location.Z                   = objectLocationZ;
            injectRequestMessage.ObjectFragment.Velocity.X                   = objectVelocityX;
            injectRequestMessage.ObjectFragment.Velocity.Y                   = objectVelocityY;
            injectRequestMessage.ObjectFragment.Velocity.Z                   = objectVelocityZ;
            injectRequestMessage.ObjectFragment.Acceleration.X               = objectAccelerationX;
            injectRequestMessage.ObjectFragment.Acceleration.Y               = objectAccelerationY;
            injectRequestMessage.ObjectFragment.Acceleration.Z               = objectAccelerationZ;
            injectRequestMessage.ObjectFragment.Orientation.X                = objectOrientationX;
            injectRequestMessage.ObjectFragment.Orientation.Y                = objectOrientationY;
            injectRequestMessage.ObjectFragment.Orientation.Z                = objectOrientationZ;
            injectRequestMessage.ObjectFragment.Orientation.W                = objectOrientationW;
            injectRequestMessage.ObjectFragment.AngularVelocity.X            = objectAngularVelocityX;
            injectRequestMessage.ObjectFragment.AngularVelocity.Y            = objectAngularVelocityY;
            injectRequestMessage.ObjectFragment.AngularVelocity.Z            = objectAngularVelocityZ;
            injectRequestMessage.ObjectFragment.AngularVelocity.W            = objectAngularVelocityW;
            injectRequestMessage.ObjectFragment.AngularAcceleration.X        = objectAngularAccelerationX;
            injectRequestMessage.ObjectFragment.AngularAcceleration.Y        = objectAngularAccelerationY;
            injectRequestMessage.ObjectFragment.AngularAcceleration.Z        = objectAngularAccelerationZ;
            injectRequestMessage.ObjectFragment.AngularAcceleration.W        = objectAngularAccelerationW;
            injectRequestMessage.ObjectFragment.ExtensionDialect             = objectExtensionDialect;
            injectRequestMessage.ObjectFragment.ExtensionDialectMajorVersion = objectExtensionDialectMajorVersion;
            injectRequestMessage.ObjectFragment.ExtensionDialectMinorVersion = objectExtensionDialectMinorVersion;
            injectRequestMessage.ObjectFragment.SetExtensionData(objectExtensionData);
            viewOne.InjectObject(injectRequestMessage);

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();


            CloudObject bubbleOneCloudObject = bubbleOne.CloudCache.GetObject(objectId);

            Assert.IsNotNull(bubbleOneCloudObject);

            CloudObject bubbleTwoCloudObject = bubbleTwo.CloudCache.GetObject(objectId);

            Assert.IsNotNull(bubbleTwoCloudObject);

            CloudObject bubbleThreeCloudObject = bubbleThree.CloudCache.GetObject(objectId);

            Assert.IsNotNull(bubbleThreeCloudObject);

            CloudObject viewOneCloudObject = viewOne.CloudCache.GetObject(objectId);

            Assert.IsNotNull(viewOneCloudObject);

            CloudObject viewTwoCloudObject = viewTwo.CloudCache.GetObject(objectId);

            Assert.IsNotNull(viewTwoCloudObject);

            ActionEventMessage originalAction = new ActionEventMessage();

            originalAction.ActionFragment.ActionName                   = actionName;
            originalAction.ActionFragment.ObservationRadius            = actionObservationRadius;
            originalAction.ActionFragment.SourceObjectId               = objectId;
            originalAction.ActionFragment.ExtensionDialect             = actionExtensionDialect;
            originalAction.ActionFragment.ExtensionDialectMajorVersion = actionExtensionDialectMajorVersion;
            originalAction.ActionFragment.ExtensionDialectMinorVersion = actionExtensionDialectMinorVersion;
            originalAction.ActionFragment.SetExtensionData(actionExtensionData);

            viewOne.ExecuteAction(originalAction);

            ActionEventMessage receivedAction = null;

            viewTwo.ServerAction += delegate(ActionEventMessage actionEvent)
            {
                receivedAction = actionEvent;
                Assert.AreEqual(actionName, receivedAction.ActionFragment.ActionName);
                Assert.AreEqual(objectId, receivedAction.ActionFragment.SourceObjectId);
                Assert.AreEqual(actionObservationRadius, receivedAction.ActionFragment.ObservationRadius);
                Assert.AreEqual(actionExtensionDialect, receivedAction.ActionFragment.ExtensionDialect);
                Assert.AreEqual(actionExtensionDialectMajorVersion, receivedAction.ActionFragment.ExtensionDialectMajorVersion);
                Assert.AreEqual(actionExtensionDialectMinorVersion, receivedAction.ActionFragment.ExtensionDialectMinorVersion);
                Assert.AreEqual(ASCIIEncoding.ASCII.GetString(actionExtensionData),
                                ASCIIEncoding.ASCII.GetString(receivedAction.ActionFragment.GetExtensionData()));
            };

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();

            Assert.IsNotNull(receivedAction);

            EjectRequestMessage ejectRequestMessage = new EjectRequestMessage();

            ejectRequestMessage.ObjectId = objectId;
            viewOne.EjectObject(ejectRequestMessage);

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();

            Assert.IsNull(bubbleOne.CloudCache.GetObject(objectId));
            Assert.IsNull(bubbleTwo.CloudCache.GetObject(objectId));
            Assert.IsNull(bubbleThree.CloudCache.GetObject(objectId));
            Assert.IsNull(viewOne.CloudCache.GetObject(objectId));
            Assert.IsNull(viewTwo.CloudCache.GetObject(objectId));

            viewOne.Disconnect();
            viewTwo.Disconnect();

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();

            serviceAlpha.Shutdown();
            serviceBeta.Shutdown();
        }