@Test public void publish_on_specific_port() throws Exception { final int iterationCount = 100; final int minAllowOk = 80; int done = 0; for (int i = 0; i < iterationCount; i++) { int p = 1025 + RandomUtils.nextInt(10000); try (Socket s = new Socket()) { s.connect(new InetSocketAddress(InetAddress.getLocalHost(), p), 50); continue; } catch (ConnectException|SocketTimeoutException e) { } done++; TService ts = new TService(); int pp = RmiServerPublisher.publish_service(TServiceI.class, ts, p); assertEquals(p, pp); try (Socket s = new Socket("localhost", p)) { } } assertTrue(done >= minAllowOk); }
public static int publish_service(Class<?> cls, Object obj) throws RmiCommException { return publish_service(cls, obj, 0); }
RmiServerPublisher { public static int publish_service(Class<?> cls, Object obj) throws RmiCommException { return publish_service(cls, obj, 0); } }
RmiServerPublisher { public static int publish_service(Class<?> cls, Object obj) throws RmiCommException { return publish_service(cls, obj, 0); }  }
RmiServerPublisher { public static int publish_service(Class<?> cls, Object obj) throws RmiCommException { return publish_service(cls, obj, 0); }  static int publish_service(Class<?> cls, Object obj); static int publish_service(Class<?> cls, Object obj, int port); static void shutdown_all(); }
RmiServerPublisher { public static int publish_service(Class<?> cls, Object obj) throws RmiCommException { return publish_service(cls, obj, 0); }  static int publish_service(Class<?> cls, Object obj); static int publish_service(Class<?> cls, Object obj, int port); static void shutdown_all();  }