private void VerifyStateTransitionsUntilConnected(bool bExchangeWorldData)
        {
            m_WorldData.Setup(d => d.RequiresInitialWorldData).Returns(bExchangeWorldData);

            // Init
            Assert.Equal(EConnectionState.Disconnected, m_Connection.State);
            m_Connection.Connect();

            // Expect client hello
            m_NetworkConnection.Verify(
                c => c.SendRaw(It.IsAny <ArraySegment <byte> >(), It.IsAny <EDeliveryMethod>()),
                Times.Once);
            ArraySegment <byte> expectedSentData = TestUtils.MakeRaw(
                EPacket.Client_Hello,
                new Client_Hello(Version.Number).Serialize());

            Assert.Equal(expectedSentData, m_SendRawParam);
            Assert.Equal(EConnectionState.ClientJoinRequesting, m_Connection.State);

            // Ack client hello
            ArraySegment <byte> response = TestUtils.MakeRaw(
                EPacket.Server_RequestClientInfo,
                new Server_RequestClientInfo().Serialize());

            m_Connection.Receive(response);
            Assert.Equal(EConnectionState.ClientJoinRequesting, m_Connection.State);

            // Expect client info
            expectedSentData = TestUtils.MakeRaw(
                EPacket.Client_Info,
                new Client_Info(new Player("Unknown")).Serialize());
            Assert.Equal(expectedSentData, m_SendRawParam);
            Assert.Equal(EConnectionState.ClientJoinRequesting, m_Connection.State);

            // Ack client info
            response = TestUtils.MakeRaw(
                EPacket.Server_JoinRequestAccepted,
                new Server_JoinRequestAccepted().Serialize());
            m_Connection.Receive(response);

            if (bExchangeWorldData)
            {
                expectedSentData = TestUtils.MakeRaw(
                    EPacket.Client_RequestWorldData,
                    new Client_RequestWorldData().Serialize());
                Assert.Equal(expectedSentData, m_SendRawParam);
                Assert.Equal(EConnectionState.ClientAwaitingWorldData, m_Connection.State);

                // Send world data to client
                response = TestUtils.MakeRaw(
                    EPacket.Server_WorldData,
                    m_WorldData.Object.SerializeInitialWorldState());
                m_Connection.Receive(response);
                Assert.Equal(EConnectionState.ClientPlaying, m_Connection.State);
            }

            // Expect client joined
            expectedSentData = TestUtils.MakeRaw(
                EPacket.Client_Joined,
                new Client_Joined().Serialize());
            Assert.Equal(expectedSentData, m_SendRawParam);
            Assert.Equal(EConnectionState.ClientPlaying, m_Connection.State);

            // Send keep alive
            ArraySegment <byte> keepAliveFromServer = TestUtils.MakeKeepAlive(42);

            m_Connection.Receive(keepAliveFromServer);
            Assert.Equal(EConnectionState.ClientPlaying, m_Connection.State);

            // Expect client keep alive response
            expectedSentData = keepAliveFromServer;
            Assert.Equal(expectedSentData, m_SendRawParam);
        }