SystemServiceManager serviceManager = new DummySystemServiceManager();
DummySystemService service = new DummySystemService();
serviceManager.registerService(service);
SystemServiceRequestHandler requestHandler =
new SystemServiceRequestHandler(serviceManager);
Isolate serviceIsolate = Isolate.currentIsolate();
Isolate clientIsolate = new Isolate(
"com.sun.midp.services.SystemServiceRequestIsolate", null);
clientIsolate.start();
IsolateSystemServiceRequestHandler isolateRequestHandler =
requestHandler.newIsolateRequestHandler(clientIsolate);
Link namedPortalLink = Link.newLink(serviceIsolate, clientIsolate);
Link[] clientLinks = { namedPortalLink };
LinkPortal.setLinks(clientIsolate, clientLinks);
NamedLinkPortal.sendLinks(namedPortalLink);
requestHandler.handleIsolateRequests(isolateRequestHandler);
clientIsolate.waitForExit();
assertTrue("Service requested", service.wasRequested);