public void HandleLifecycle() { Association a = HmacShaAssociation.Create(Protocol.Default, Protocol.Default.Args.SignatureAlgorithm.HMAC_SHA1, "somehandle", sha1Secret, TimeSpan.FromDays(1)); assocs.Set(a); Assert.AreSame(a, assocs.Get(a.Handle)); Assert.IsTrue(assocs.Remove(a.Handle)); Assert.IsNull(assocs.Get(a.Handle)); Assert.IsFalse(assocs.Remove(a.Handle)); }
public void StoreAssociation(TKey distinguishingFactor, Association assoc) { lock (this) { if (!serverAssocsTable.ContainsKey(distinguishingFactor)) { serverAssocsTable.Add(distinguishingFactor, new Associations()); } Associations server_assocs = serverAssocsTable[distinguishingFactor]; server_assocs.Set(assoc); } }