EntryPointContext ctx2 = (EntryPointContext) child.getContext("source");
Assert.assertNotNull(ctx2);
response = handler.invoke(null, hello, new Object[]{"foo"});
Assert.assertEquals("Hello foo", response);
Assert.assertEquals(2, mockInterceptor.getCount());
HelloWorldService service1 = (HelloWorldService) child.getContext("target").getInstance(null);
Assert.assertEquals(2, service1.count());
child.publish(new RequestEnd(this, id2));
child.publish(new HttpSessionEnd(this, session));
// second session
Object session2 = new Object();
child.publish(new RequestStart(this, new Object()));
child.publish(new HttpSessionBound(this, session2));
ctx = (EntryPointContext) child.getContext("source");
Assert.assertNotNull(ctx);
Assert.assertEquals(2, mockInterceptor.getCount());
response = handler.invoke(null, hello, new Object[]{"foo"});
Assert.assertEquals("Hello foo", response);
Assert.assertEquals(3, mockInterceptor.getCount());
child.publish(new HttpSessionBound(this, session2));
Object id3 = new Object();
child.publish(new RequestStart(this, id3));
child.publish(new HttpSessionBound(this, session2));
ctx2 = (EntryPointContext) child.getContext("source");
Assert.assertNotNull(ctx2);
response = handler.invoke(null, hello, new Object[]{"foo"});
Assert.assertEquals("Hello foo", response);
Assert.assertEquals(4, mockInterceptor.getCount());
HelloWorldService service2 = (HelloWorldService) child.getContext("target").getInstance(null);
Assert.assertEquals(2, service2.count());
Assert.assertEquals(2, service1.count()); //ensure sessions not crossed
child.publish(new RequestEnd(this, session2));
child.publish(new HttpSessionBound(this, session2));
child.publish(new ModuleStop(this));