/// <summary>
        /// Handles communication with an XMPP Provisioning Server.
        /// </summary>
        /// <param name="Client">XMPP Client to use for communication.</param>
        /// <param name="Address">Provisioning Server JID or component address.</param>
        /// <param name="MaxCacheSize">Maximum number of queries to store in the cache.</param>
        public ProvisioningServer(XmppClient Client, string Address, int MaxCacheSize)
        {
            this.client       = Client;
            this.address      = Address;
            this.maxCacheSize = MaxCacheSize;
            this.nrCacheItems = 0;

            this.client.AddClientSpecificIqHandler("clearCache", "urn:xmpp:iot:provisioning", this.ClearCache);
            this.client.AddClientSpecificIqHandler("friend", "urn:xmpp:iot:provisioning", this.OnFriendHandler);
            this.client.AddClientSpecificIqHandler("unfriend", "urn:xmpp:iot:provisioning", this.OnUnfriendHandler);
            this.client.AddClientSpecificIqHandler("tokenChallenge", "urn:xmpp:iot:provisioning", this.OnTokenChallenge);

            this.client.AddClientSpecificApplicationMessageHandler("clearCache", "urn:xmpp:iot:provisioning", this.ClearCache);
            this.client.AddClientSpecificApplicationMessageHandler("friend", "urn:xmpp:iot:provisioning", this.OnFriendHandler);
            this.client.AddClientSpecificApplicationMessageHandler("unfriend", "urn:xmpp:iot:provisioning", this.OnUnfriendHandler);

            int TypeId = DB.GetTypeId(typeof(CacheItem));

            foreach (CacheItem Item in db.FindObjects <CacheItem>())
            {
                this.itemByHash [Item.Hash]             = Item;
                this.itemByLastAccess [Item.LastAccess] = Item;
            }

            this.nrCacheItems = this.itemByHash.Count;
            this.MakeRoom(0);
        }