}
private Session createAndUseSession(DistributableSessionManager<?> manager, String id, boolean canCreate, boolean access)
throws Exception {
// Shift to Manager interface when we simulate Tomcat
Manager mgr = manager;
Session sess = mgr.findSession(id);
assertNull("session does not exist", sess);
try {
sess = mgr.createSession(id, new Random());
if (!canCreate)
fail("Could not create session" + id);
} catch (IllegalStateException ise) {
if (canCreate) {
log.error("Failed to create session " + id, ise);