List of usage examples for java.rmi ConnectIOException getCause
public Throwable getCause()
From source file:org.ut.biolab.medsavant.MedSavantClient.java
public static void initializeRegistry(String serverAddress, String serverPort) throws RemoteException, NotBoundException, NoRouteToHostException, ConnectIOException { if (initialized) { return;// ww w .jav a 2 s . com } int port = (new Integer(serverPort)).intValue(); Registry registry; LOG.debug("Connecting to MedSavantServerEngine @ " + serverAddress + ":" + serverPort + "..."); try { registry = LocateRegistry.getRegistry(serverAddress, port, new SslRMIClientSocketFactory()); LOG.debug("Retrieving adapters..."); setAdaptersFromRegistry(registry); LOG.info("Connected with SSL/TLS Encryption"); } catch (ConnectIOException ex) { if (ex.getCause() instanceof SSLHandshakeException) { registry = LocateRegistry.getRegistry(serverAddress, port); LOG.debug("Retrieving adapters..."); setAdaptersFromRegistry(registry); LOG.info("Connected without SSL/TLS encryption"); } } LOG.debug("Done"); }
From source file:org.ut.biolab.medsavant.MedSavantServlet.java
public void initializeRegistry(String serverAddress, String serverPort) throws RemoteException, NotBoundException, NoRouteToHostException, ConnectIOException { if (initialized) { return;// w ww. j a v a 2s . c om } int port = (new Integer(serverPort)).intValue(); Registry registry; LOG.info("Connecting to MedSavantServerEngine @ " + serverAddress + ":" + serverPort + "..."); try { registry = LocateRegistry.getRegistry(serverAddress, port, new SslRMIClientSocketFactory()); LOG.debug("Retrieving adapters..."); setAdaptersFromRegistry(registry); setLocalAdapters(); LOG.info("Connected with SSL/TLS Encryption"); initialized = true; } catch (ConnectIOException ex) { if (ex.getCause() instanceof SSLHandshakeException) { registry = LocateRegistry.getRegistry(serverAddress, port); LOG.info("Retrieving adapters..."); setAdaptersFromRegistry(registry); LOG.info("Connected without SSL/TLS encryption"); } } LOG.info("Done"); }