Beispiel #1
0
    public void SetUp()
    {
        RTMRegistration.Register();
        this._processor = new RTMProcessor();
        Integration_RTMProcessor self = this;

        this._eventDelegate = (evd) => {
            self._processor.OnSecond(evd.GetTimestamp());
        };
        FPManager.Instance.AddSecond(this._eventDelegate);
        IDictionary <string, object> dict = new Dictionary <string, object>()
        {
            { "from", 123 },
            { "to", 456 },
            { "gid", 666 },
            { "rid", 777 },
            { "mtype", 8 },
            { "mid", 1570535270000003 },
            { "msg", "hello" },
            { "attrs", "{}" },
            { "mtime", 157053527000 },
        };

        try {
            using (MemoryStream outputStream = new MemoryStream()) {
                MsgPack.Serialize(dict, outputStream);
                outputStream.Seek(0, SeekOrigin.Begin);
                this._bytes = outputStream.ToArray();
            }
        } catch (Exception ex) {
            Debug.LogError(ex);
        }
    }
 public void TearDown()
 {
     if (this._processor != null)
     {
         this._processor.Destroy();
         this._processor = null;
     }
 }
Beispiel #3
0
    public void StartTest(byte[] fileBytes)
    {
        this._fileBytes = fileBytes;
        this._client    = new RTMClient(
            "52.83.245.22:13325",
            11000001,
            this._uid,
            this._token,
            // "rtm-intl-frontgate.funplus.com:13325",
            // 11000002,
            // 777779,
            // "BE3732174850E479209443BCCDF4747D",
            // "52.83.245.22:13325",
            // 1000012,
            // 654321,
            // "63B3F146B2A1DA8660B167D26A610C0D",
            // "rtm-intl-frontgate.funplus.com:13325",
            // 11000001,
            // 777779,
            // "12861748F2D641907D181D1CDB6DF174",
            RTMConfig.TRANS_LANGUAGE.en,
            new Dictionary <string, string>(),
            true,
            20 * 1000,
            true
            );
        RTMProcessor processor = this._client.GetProcessor();

        processor.AddPushService(RTMConfig.SERVER_PUSH.recvMessage, (data) => {
            Debug.Log("[recvMessage]: " + Json.SerializeToString(data));
            Debug.Log("[recvMessage]: " + data["msg"]);
        });
        TestCase self = this;

        this._client.GetEvent().AddListener("login", (evd) => {
            Exception ex = evd.GetException();

            if (ex != null)
            {
                Debug.Log("TestCase connect err: " + ex.Message);
            }
            else
            {
                Debug.Log("TestCase connect! gate: " + evd.GetPayload());
                self.StartThread();
            }
        });
        this._client.GetEvent().AddListener("close", (evd) => {
            Debug.Log("TestCase closed!");
        });
        this._client.GetEvent().AddListener("error", (evd) => {
            Debug.Log("TestCase error: " + evd.GetException());
        });
        this._client.Login(null);
    }
Beispiel #4
0
    public void TearDown()
    {
        if (this._eventDelegate != null)
        {
            FPManager.Instance.RemoveSecond(this._eventDelegate);
            this._eventDelegate = null;
        }

        if (this._processor != null)
        {
            this._processor.Destroy();
            this._processor = null;
        }
    }
        public TestCase(byte[] fileBytes)
        {
            this._fileBytes = fileBytes;

            this._client = new RTMClient(
                "52.83.245.22:13325",
                1000012,
                654321,
                "0A224F454FF701EBB5AA8A99836DA73E",
                null,
                new Dictionary <string, string>(),
                true,
                20 * 1000,
                true
                );

            RTMProcessor processor = this._client.GetProcessor();

            processor.GetEvent().AddListener(RTMConfig.SERVER_PUSH.recvPing, (evd) => {
                Debug.Log("[PUSH] ping: " + Json.SerializeToString(evd.GetPayload()));
            });

            this._client.GetEvent().AddListener("login", (evd) => {
                Exception ex = evd.GetException();

                if (ex != null)
                {
                    Debug.Log("TestCase connect err: " + ex.Message);
                }
                else
                {
                    Debug.Log("TestCase connect!");
                    OnLogin();
                }
            });

            this._client.GetEvent().AddListener("close", (evd) => {
                Debug.Log("TestCase closed!");
            });

            this._client.GetEvent().AddListener("error", (evd) => {
                Debug.Log("TestCase error: " + evd.GetException().Message);
            });

            this._client.Login(null, false);
        }
Beispiel #6
0
    public void StartTest(byte[] fileBytes)
    {
        receiveClient = new RTMClient(
            "52.83.245.22:13325",
            11000001,
            777779,
            TOKEN_777779,
            RTMConfig.TRANS_LANGUAGE.en,
            new Dictionary <string, string>(),
            true,
            20 * 1000,
            true
            );

        SingleMicphone self = this;

        receiveClient.GetEvent().AddListener("login", (evd) => {
            if (evd.GetException() == null)
            {
                Debug.Log("777779 login!");
            }
            else
            {
                Debug.Log(evd.GetException());
            }
        });
        receiveClient.GetEvent().AddListener("error", (evd) => {
            Debug.Log(evd.GetException());
        });
        RTMProcessor processor = receiveClient.GetProcessor();

        processor.AddPushService(RTMConfig.SERVER_PUSH.recvAudio, (data) => {
            Debug.Log("777779 receive audio!");
            lock (self_locker) {
                self._audioBytes = (byte[])data["msg"];
            }
        });
        receiveClient.Login(null);
        this._micphone = new BaseMicrophone();
        RTMMicrophone.Instance.InitMic(null, this._micphone);
        Debug.Log("microphone start input!");
        RTMMicrophone.Instance.StartInput();
    }
Beispiel #7
0
    public void StartTest(byte[] fileBytes)
    {
        this._client = new RTMClient(
            "52.83.245.22:13325",
            11000001,
            777779,
            "FA77FB4FA1E19E3EA7A9500DC6D9649C",
            RTMConfig.TRANS_LANGUAGE.en,
            new Dictionary <string, string>(),
            true,
            20 * 1000,
            // false
            true
            );
        SingleClientSend self = this;

        this._client.GetEvent().AddListener("login", (evd) => {
            if (evd.GetException() == null)
            {
                Debug.Log("test start!");
                self.StartThread();
            }
            else
            {
                Debug.Log(evd.GetException());
            }
        });
        this._client.GetEvent().AddListener("close", (evd) => {
            Debug.Log("closed!");
            self.StopThread();
        });
        this._client.GetEvent().AddListener("error", (evd) => {
            Debug.Log(evd.GetException());
        });
        RTMProcessor processor = this._client.GetProcessor();

        processor.AddPushService(RTMConfig.SERVER_PUSH.recvMessage, (data) => {
            Debug.Log("[recvMessage]: " + Json.SerializeToString(data));
        });
        this._client.Login(null);
    }
 public void SetUp()
 {
     this._processor = new RTMProcessor();
 }
    public void StartTest(byte[] fileBytes)
    {
        this._client = new RTMClient(
            "rtm-intl-frontgate.funplus.com:13325",
            11000002,
            777779,
            "266B02147F447DD931C48B747F5ED9E7",
            RTMConfig.TRANS_LANGUAGE.en,
            new Dictionary <string, string>(),
            true,
            20 * 1000,
            // false
            true
            );
        SingleClientPush self = this;

        this._client.GetEvent().AddListener("login", (evd) => {
            if (evd.GetException() == null)
            {
                Debug.Log("test start!");
            }
            else
            {
                Debug.Log(evd.GetException());
            }
        });
        this._client.GetEvent().AddListener("close", (evd) => {
            Debug.Log("closed!");
        });
        this._client.GetEvent().AddListener("error", (evd) => {
            Debug.Log(evd.GetException());
        });
        RTMProcessor processor = this._client.GetProcessor();

        processor.AddPushService(RTMConfig.SERVER_PUSH.recvPing, (data) => {
            self.RevcInc();
            // Debug.Log("[PUSH] ping: " + Json.SerializeToString(data));
        });
        processor.AddPushService(RTMConfig.SERVER_PUSH.recvMessage, (data) => {
            self.RevcInc();
            // Debug.Log("[recvMessage]: " + Json.SerializeToString(data));
        });
        processor.AddPushService(RTMConfig.SERVER_PUSH.recvGroupMessage, (data) => {
            self.RevcInc();
            // Debug.Log("[recvGroupMessage]: ");
        });
        processor.AddPushService(RTMConfig.SERVER_PUSH.recvRoomMessage, (data) => {
            self.RevcInc();
            // Debug.Log("[recvRoomMessage]: ");
        });
        processor.AddPushService(RTMConfig.SERVER_PUSH.recvBroadcastMessage, (data) => {
            self.RevcInc();
            // Debug.Log("[recvBroadcastMessage]: ");
        });
        processor.AddPushService(RTMConfig.SERVER_PUSH.recvFile, (data) => {
            self.RevcInc();
            // Debug.Log("[recvFile]: ");
        });
        processor.AddPushService(RTMConfig.SERVER_PUSH.recvRoomFile, (data) => {
            self.RevcInc();
            // Debug.Log("[recvRoomFile]: ");
        });
        processor.AddPushService(RTMConfig.SERVER_PUSH.recvGroupFile, (data) => {
            self.RevcInc();
            // Debug.Log("[recvGroupFile]: ");
        });
        processor.AddPushService(RTMConfig.SERVER_PUSH.recvBroadcastFile, (data) => {
            self.RevcInc();
            // Debug.Log("[recvBroadcastFile]: ");
        });
        this._client.Login(null);
    }