// Set up the client side (using the WSDD above)
Service svc = new Service(provider);
Call call = (Call)svc.createCall();
call.setMaintainSession(true);
call.setTransport(new LocalTransport(server));
// Try it - first invocation should return 1.
Integer count = (Integer)call.invoke("sessionTest", "counter", null);
assertNotNull("count was null!", count);
assertEquals("count was " + count + " (expected 1)", count.intValue(),
1);
// Next invocation should return 2, assuming the session-based
// counter is working.
count = (Integer)call.invoke("sessionTest", "counter", null);
assertEquals("count was " + count + " (expected 2)", count.intValue(),
2);
// Now start fresh and confirm a new session
Service svc2 = new Service(provider);
Call call2 = (Call)svc2.createCall();
call2.setMaintainSession(true);
call2.setTransport(new LocalTransport(server));
// New session should cause us to return 1 again.
count = (Integer)call2.invoke("sessionTest", "counter", null);
assertNotNull("count was null on third call!", count);
assertEquals("New session count was incorrect", 1,