< prev index next >

test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java

Print this page

        

*** 41,62 **** import java.net.MalformedURLException; import java.rmi.*; import java.rmi.registry.*; public class UseCustomSocketFactory { ! static final int REGISTRY_PORT = TestLibrary.getUnusedRandomPort(); static String[] protocol = new String[] { "", "compress", "xor" }; public static void main(String[] args) { System.out.println("\nRegression test for bug 4115696\n"); TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); try { ! LocateRegistry.createRegistry(REGISTRY_PORT); } catch (RemoteException e) { TestLibrary.bomb("creating registry", e); } RMID rmid = null; --- 41,63 ---- import java.net.MalformedURLException; import java.rmi.*; import java.rmi.registry.*; public class UseCustomSocketFactory { ! static int registryPort = -1; static String[] protocol = new String[] { "", "compress", "xor" }; public static void main(String[] args) { System.out.println("\nRegression test for bug 4115696\n"); TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); try { ! Registry reg = LocateRegistry.createRegistry(0); ! registryPort = TestLibrary.getRegistryPort(reg); } catch (RemoteException e) { TestLibrary.bomb("creating registry", e); } RMID rmid = null;
*** 88,98 **** for (int i = 0; i < protocol.length; i++) { JavaVM serverVM = new JavaVM("EchoImpl", "-Djava.security.policy=" + TestParams.defaultPolicy + " -Drmi.registry.port=" + ! REGISTRY_PORT + " -Djava.rmi.activation.port=" + rmidPort, protocol[i]); System.err.println("\nusing protocol: " + --- 89,99 ---- for (int i = 0; i < protocol.length; i++) { JavaVM serverVM = new JavaVM("EchoImpl", "-Djava.security.policy=" + TestParams.defaultPolicy + " -Drmi.registry.port=" + ! registryPort + " -Djava.rmi.activation.port=" + rmidPort, protocol[i]); System.err.println("\nusing protocol: " +
*** 106,116 **** echo[i] = null; // 24 seconds timeout long stopTime = System.currentTimeMillis() + 24000; do { try { ! echo[i] = (Echo) Naming.lookup("//:" + REGISTRY_PORT + "/EchoServer"); break; } catch (NotBoundException e) { try { Thread.sleep(200); --- 107,117 ---- echo[i] = null; // 24 seconds timeout long stopTime = System.currentTimeMillis() + 24000; do { try { ! echo[i] = (Echo) Naming.lookup("//:" + registryPort + "/EchoServer"); break; } catch (NotBoundException e) { try { Thread.sleep(200);
*** 136,146 **** TestLibrary.bomb("test failed", e); } finally { serverVM.destroy(); try { ! Naming.unbind("//:" + REGISTRY_PORT + "/EchoServer"); } catch (RemoteException | NotBoundException | MalformedURLException e) { TestLibrary.bomb("unbinding EchoServer", e); } } } --- 137,147 ---- TestLibrary.bomb("test failed", e); } finally { serverVM.destroy(); try { ! Naming.unbind("//:" + registryPort + "/EchoServer"); } catch (RemoteException | NotBoundException | MalformedURLException e) { TestLibrary.bomb("unbinding EchoServer", e); } } }
< prev index next >