Search in sources :

Example 1 with RMIHttpToPortSocketFactory

use of sun.rmi.transport.proxy.RMIHttpToPortSocketFactory 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);
    }
}
Also used : RMIHttpToPortSocketFactory(sun.rmi.transport.proxy.RMIHttpToPortSocketFactory) Remote(java.rmi.Remote) LocateRegistry(java.rmi.registry.LocateRegistry) Registry(java.rmi.registry.Registry) RemoteException(java.rmi.RemoteException)

Aggregations

Remote (java.rmi.Remote)1 RemoteException (java.rmi.RemoteException)1 LocateRegistry (java.rmi.registry.LocateRegistry)1 Registry (java.rmi.registry.Registry)1 RMIHttpToPortSocketFactory (sun.rmi.transport.proxy.RMIHttpToPortSocketFactory)1