use of org.atmosphere.cpr.AtmosphereRequestImpl.NoOpsRequest in project atmosphere by Atmosphere.
the class SessionTest method sessionReplacementTest.
@Test
public void sessionReplacementTest() {
AtmosphereConfig config = new AtmosphereFramework().getAtmosphereConfig();
config.setSupportSession(true);
HttpServletRequest httpRequest = new NoOpsRequest();
AtmosphereRequest request = new AtmosphereRequestImpl.Builder().request(httpRequest).session(httpRequest.getSession(true)).build();
AtmosphereResponse response = new AtmosphereResponseImpl.Builder().build();
AtmosphereResource r = config.resourcesFactory().create(config, request, response, mock(AsyncSupport.class));
request.setAttribute(FrameworkConfig.ATMOSPHERE_RESOURCE, r);
assertNotNull(request.getSession());
request.getSession().invalidate();
assertNull(request.getSession(false));
assertNotNull(r.session(true));
}
Aggregations