use of java.rmi.Remote in project jdk8u_jdk by JetBrains.
the class Receiver method main.
public static void main(String[] args) throws Exception {
System.err.println("\nRegression test for bug 4513223\n");
Remote impl2 = null;
try {
Remote impl = new MarshalAfterUnexport2();
System.err.println("created impl extending URO (with a UnicastServerRef2): " + impl);
Receiver stub = (Receiver) RemoteObject.toStub(impl);
System.err.println("stub for impl: " + stub);
UnicastRemoteObject.unexportObject(impl, true);
System.err.println("unexported impl");
impl2 = new MarshalAfterUnexport2();
Receiver stub2 = (Receiver) RemoteObject.toStub(impl2);
System.err.println("marshalling unexported object:");
MarshalledObject mobj = new MarshalledObject(impl);
System.err.println("passing unexported object via RMI-JRMP:");
stub2.receive(stub);
System.err.println("TEST PASSED");
} finally {
if (impl2 != null) {
try {
UnicastRemoteObject.unexportObject(impl2, true);
} catch (Throwable t) {
}
}
}
}
use of java.rmi.Remote in project jdk8u_jdk by JetBrains.
the class HttpSocketTest method main.
public static void main(String[] args) throws Exception {
Registry registry = null;
TestLibrary.suggestSecurityManager(null);
// Set the socket factory.
System.err.println("installing socket factory");
RMISocketFactory.setSocketFactory(new RMIHttpToPortSocketFactory());
int registryPort = -1;
try {
System.err.println("Starting registry");
registry = TestLibrary.createRegistryOnUnusedPort();
registryPort = TestLibrary.getRegistryPort(registry);
} catch (Exception e) {
TestLibrary.bomb(e);
}
try {
registry.rebind(NAME, new HttpSocketTest());
MyRemoteInterface httpTest = (MyRemoteInterface) Naming.lookup("//:" + registryPort + "/" + NAME);
httpTest.setRemoteObject(new HttpSocketTest());
Remote r = httpTest.getRemoteObject();
} catch (Exception e) {
TestLibrary.bomb(e);
}
}
use of java.rmi.Remote in project jdk8u_jdk by JetBrains.
the class ReuseDefaultPort method main.
public static void main(String[] args) throws Exception {
System.err.println("\nRegression test for bug 6269166\n");
RMISocketFactory.setSocketFactory(new SF());
Remote impl = new ReuseDefaultPort();
Remote stub = UnicastRemoteObject.exportObject(impl, 0);
System.err.println("- exported object: " + stub);
try {
Registry registry = LocateRegistry.createRegistry(PORT);
System.err.println("- exported registry: " + registry);
System.err.println("TEST PASSED");
} finally {
UnicastRemoteObject.unexportObject(impl, true);
}
}
use of java.rmi.Remote in project jdk8u_jdk by JetBrains.
the class RapidExportUnexport method main.
public static void main(String[] args) throws Exception {
System.err.println("\nRegression test for bug 6275081\n");
Remote impl = new Remote() {
};
long start = System.currentTimeMillis();
for (int i = 0; i < REPS; i++) {
System.err.println(i);
UnicastRemoteObject.exportObject(impl, PORT);
UnicastRemoteObject.unexportObject(impl, true);
// work around BindException (bug?)
Thread.sleep(1);
}
long delta = System.currentTimeMillis() - start;
System.err.println(REPS + " export/unexport operations took " + delta + "ms");
if (delta > TIMEOUT) {
throw new Error("TEST FAILED: took over " + TIMEOUT + "ms");
}
System.err.println("TEST PASSED");
}
use of java.rmi.Remote in project jdk8u_jdk by JetBrains.
the class LegalRegistryNames method main.
public static void main(String[] args) throws RuntimeException {
System.err.println("\nRegression test for bug/rfe 4254808\n");
Registry registry = null;
LegalRegistryNames legal = null;
boolean oneFormFailed = false;
String[] names = null;
Vector legalForms = getLegalForms();
Remote shouldFind = null;
// create a registry and the test object
try {
legal = new LegalRegistryNames();
System.err.println("Starting registry on default port");
registry = LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
} catch (Exception e) {
TestLibrary.bomb("registry already running on test port");
}
// enumerate through all legal URLs to verify that a remote
// object can be bound and unbound
String s = null;
Enumeration en = legalForms.elements();
while (en.hasMoreElements()) {
s = (String) en.nextElement();
System.err.println("\ntesting form: " + s);
try {
Naming.rebind(s, legal);
names = registry.list();
// ensure that the name in the registry is what is expected
if ((names.length > 0) && (names[0].compareTo("MyName") != 0)) {
oneFormFailed = true;
System.err.println("\tRegistry entry for form: " + s + " is incorrect: " + names[0]);
}
// ensure that the object can be unbound under the URL string
shouldFind = Naming.lookup(s);
Naming.unbind(s);
System.err.println("\tform " + s + " OK");
} catch (Exception e) {
e.printStackTrace();
oneFormFailed = true;
System.err.println("\tunexpected lookup or unbind " + "exception for form: " + s + e.getMessage());
}
}
if (oneFormFailed) {
TestLibrary.bomb("Test failed");
}
// get the test to exit quickly
TestLibrary.unexport(legal);
}
Aggregations