GrizzlySessionManager implements SessionManager { @Override public void configureSessionCookie(final Request request, final Cookie cookie) { String requestUrlString = request.getRequestURL().toString(); URI requestUrl = URI.create(requestUrlString); cookie.setDomain(requestUrl.getHost()); cookie.setHttpOnly(true); cookie.setSecure(true); cookie.setName(sessionCookieName); cookie.setMaxAge(sessionMaxAge); cookie.setVersion(1); } @Inject  GrizzlySessionManager(final SystemConfiguration c,
                                 final Provider<SessionFactory> sfProvider); @Override Session getSession(final Request request,
                              final String requestedSessionId); @Override Session createSession(final Request request); @Override String changeSessionId(final Request request,
                                  final Session session); @Override String getSessionCookieName(); @Override void setSessionCookieName(final String name); @Override void configureSessionCookie(final Request request,
                                       final Cookie cookie);  }
@Test public void testConfigureSessionCookie() throws Exception { Request r = mock(Request.class); doReturn(new StringBuilder("http: .when(r) .getRequestURL(); Cookie c = new Cookie("JSESSIONID", null); manager.configureSessionCookie(r, c); assertEquals("example.com", c.getDomain()); assertEquals(1, c.getVersion()); assertTrue(c.isHttpOnly()); assertTrue(c.isSecure()); assertEquals(AuthzServerConfig.SESSION_NAME.getValue(), c.getName()); assertEquals(AuthzServerConfig.SESSION_MAX_AGE.getValue(), Integer.valueOf(c.getMaxAge())); }