Пример #1
0
        public void Constructor_ValuesSaved()
        {
            // arrange
            string hostname = "some.hostname";
            int port = 435;
            bool isSsl = true;

            // act
            var client = new XmppClient(hostname, port, isSsl);

            // assert
            Assert.AreEqual(hostname, client.Hostname, "hostname is not saved properly");
            Assert.AreEqual(port, client.Port, "port is not saved properly");
            Assert.AreEqual(isSsl, client.UsesSslConnection, "ssl is not saved properly");
        }
Пример #2
0
        public CcsClient(string senderId, string apiKey, bool useStagingGcmServers = false)
        {
            this.SenderId = senderId;
            this.apiKey = apiKey;
            this.UseStagingGcmServers = useStagingGcmServers;

            // set endpoing:port to use
            this.Endpoint = useStagingGcmServers ? StagingCcsEndpoint : CcsEndpoint;
            this.Port = useStagingGcmServers ? StagingCcsPort : CcsPort;

            // must use ssl connection for gcm-ccs
            // // bind connect handlers
            this.xmppClient = new XmppClient(this.Endpoint, this.Port, true);
            this.xmppClient.OnConnected += onConnected;
            this.xmppClient.OnConnectException += onConnectException;

            // setup sasl hander
            this.saslHandler = new SaslXmppHandler(this.xmppClient);
            this.saslHandler.AddAuthenticationSet(PlainAuthenticationMechanism, this.getGcmCcsPassword());
        }