Isolate zero = Isolate.currentIsolate();
Isolate one = new Isolate("com.sun.midp.links.Echo", null);
Isolate two = new Isolate("com.sun.midp.links.Echo", null);
one.start();
two.start();
Link link01 = Link.newLink(zero, one);
Link link12 = Link.newLink(one, two);
Link link20 = Link.newLink(two, zero);
LinkPortal.setLinks(one, new Link[] { link01, link12 });
LinkPortal.setLinks(two, new Link[] { link12, link20 });
String ss = "Mr. Watson, come here. I want you!";
link01.send(LinkMessage.newStringMessage(ss));
LinkMessage lm = link20.receive();
assertTrue("contains string", lm.containsString());
String rs = lm.extractString();
assertNotSame("strings not same", ss, rs);
assertEquals("strings equal", ss, rs);
LinkPortal.setLinks(one, null);
LinkPortal.setLinks(two, null);
one.exit(0);
two.exit(0);
one.waitForExit();
two.waitForExit();