private void checkSslConfig() throws IOException { // Get the reference to the RMI Registry and lookup RMIServer stub // Registry registry; try { registry = LocateRegistry.getRegistry(registryHostName, registryPort, sslRMIClientSocketFactory); try { stub = (RMIServer) registry.lookup("jmxrmi"); } catch (NotBoundException nbe) { throw (IOException) new IOException(nbe.getMessage()).initCause(nbe); } sslRegistry = true; } catch (IOException e) { registry = LocateRegistry.getRegistry(registryHostName, registryPort); try { stub = (RMIServer) registry.lookup("jmxrmi"); } catch (NotBoundException nbe) { throw (IOException) new IOException(nbe.getMessage()).initCause(nbe); } sslRegistry = false; } // Perform the checks for secure stub // try { checkStub(stub, rmiServerImplStubClass); sslStub = true; } catch (SecurityException e) { sslStub = false; } }
/** * *************************************************************** * * @param ip * @param port * @return */ public ChordMessageInterface rmiChord(String ip, int port) { ChordMessageInterface chord = null; try { Registry registry = LocateRegistry.getRegistry(ip, port); chord = (ChordMessageInterface) (registry.lookup("Chord")); return chord; } catch (RemoteException e) { e.printStackTrace(); } catch (NotBoundException e) { e.printStackTrace(); } return null; }