public void _04_CloseAllSessionsTest() { using (IPkcs11 pkcs11 = Settings.Factories.Pkcs11Factory.CreatePkcs11(Settings.Factories, Settings.Pkcs11LibraryPath, Settings.AppType)) { // Find first slot with token present ISlot slot = Helpers.GetUsableSlot(pkcs11); // Open RO (read-only) session ISession session = slot.OpenSession(SessionType.ReadOnly); // Do something interesting in RO session Assert.IsNotNull(session); // All sessions can be closed with CloseAllSessions method of Slot class. slot.CloseAllSessions(); } }