static class Injection { int vmPort; S injectionID; } static L injectToAll(S progID) { new L l; S line = format3("Please inject program *.", progID); for (DialogIO injectionPoint : talkToAll("This is a JavaX VM.")) try { injectionPoint.readLine(); S answer = injectionPoint.askLoudly(line); new Matches m; if (match3("OK. Injection ID: *", answer, m)) { new Injection i; i.vmPort = injectionPoint.getSocket().getPort(); i.injectionID = m.unq(0); l.add(i); } // just ignore for now if bad result } finally { injectionPoint.close(); } ret l; }