Exemple #1
0
        public void Can_send_prelogin_packet()
        {
            var connection = new ServerConnection(ServerConnectionStatus.PreLogin);
            var testStream = new TestMemoryStream();

            connection.Send(FakePackets.Instantiate(FakePackets.InitialLoginRequest), testStream);

            testStream.ActualBytes.Should().BeEquivalentTo(FakePackets.InitialLoginRequestEncrypted);
        }
Exemple #2
0
        public void Can_send_game_packet()
        {
            var connection = CreateEncryptedConnection(ServerConnectionStatus.Game);
            var testStream = new TestMemoryStream();

            connection.Send(FakePackets.Instantiate(FakePackets.GameServerLoginRequest), testStream);

            testStream.ActualBytes.Should().BeEquivalentTo(FakePackets.GameServerLoginRequestEncrypted);
        }
        public void Can_send_game_packet()
        {
            var packet            = FakePackets.Instantiate(FakePackets.EnableLockedClientFeatures);
            var expectedSentBytes = new byte[] { 0xB3, 0x32, 0x98, 0xDA };
            var connection        = new UltimaClientConnection(UltimaClientConnectionStatus.Game);
            var outputStream      = new TestMemoryStream();

            connection.Send(packet, outputStream);

            outputStream.ActualBytes.Should().BeEquivalentTo(expectedSentBytes);
        }
        public void Can_send_prelogin_packet()
        {
            var packet            = FakePackets.Instantiate(FakePackets.GameServerList);
            var expectedSentBytes = FakePackets.GameServerList;
            var connection        = new UltimaClientConnection(UltimaClientConnectionStatus.ServerLogin);
            var outputStream      = new TestMemoryStream();

            connection.Send(packet, outputStream);

            outputStream.ActualBytes.Should().BeEquivalentTo(expectedSentBytes);
        }
        public void Can_write_diagnostic_info_about_sent_PreGameLogin_packet()
        {
            var packet           = FakePackets.Instantiate(FakePackets.ConnectToGameServer);
            var diagnosticStream = new TextDiagnosticPushStream();
            var connection       = new UltimaClientConnection(UltimaClientConnectionStatus.PreGameLogin, NullDiagnosticPullStream.Instance, diagnosticStream);
            var outputStream     = new TestMemoryStream();

            connection.Send(packet, outputStream);

            var output = diagnosticStream.Flush();

            output.Should().Contain("0x8C, 0x7F, 0x00, 0x00, 0x01, 0x0A, 0x21, 0x7F, 0x00, 0x00, 0x01");
        }
        public void Can_write_diagnostic_info_about_send_Game_packet()
        {
            var packet           = FakePackets.Instantiate(FakePackets.EnableLockedClientFeatures);
            var diagnosticStream = new TextDiagnosticPushStream();
            var connection       = new UltimaClientConnection(UltimaClientConnectionStatus.Game, NullDiagnosticPullStream.Instance, diagnosticStream);
            var outputStream     = new TestMemoryStream();

            connection.Send(packet, outputStream);

            string output = diagnosticStream.Flush();

            output.Should().Contain("0xB9, 0x80, 0x1F")
            .And.Contain("0xB3, 0x32, 0x98, 0xDA");
        }
Exemple #7
0
        public void Can_write_diagnostic_info_about_sent_PreLogin_packet()
        {
            var diagnosticStream = new TextDiagnosticPushStream();

            var connection = new ServerConnection(ServerConnectionStatus.PreLogin, NullDiagnosticPullStream.Instance,
                                                  diagnosticStream);
            var testStream = new TestMemoryStream();

            connection.Send(FakePackets.Instantiate(FakePackets.InitialLoginRequest), testStream);

            var output = diagnosticStream.Flush();

            output.Should().Contain("0x80, 0x61, 0x64, 0x6D, 0x69, 0x6E")
            .And.Contain("0x7A, 0x63, 0x9A, 0xED, 0x56, 0x0E");
        }