Package java.net

Examples of java.net.NoRouteToHostException


                    }

                    @Override
                    protected int write(NioSession session, IoBuffer buf,
                            int length) throws Exception {
                        throw new NoRouteToHostException(
                                "No Route To Host Test");
                    }

                    @Override
                    protected boolean isBrokenConnection() throws IOException {
View Full Code Here


        assertTrue(failureDetector.isAvailable(node));

        failureDetector.recordException(node,
                                        0,
                                        new UnreachableStoreException("intentionalerror",
                                                                      new NoRouteToHostException("intentionalerror")));
        assertEquals(false, failureDetector.isAvailable(node));
        time.sleep(BANNAGE_MILLIS + 1);
        assertTrue(failureDetector.isAvailable(node));
    }
View Full Code Here

    } else if (exception instanceof SocketTimeoutException) {
      return (SocketTimeoutException)new SocketTimeoutException(
           "Call to " + addr + " failed on socket timeout exception: "
                      + exception).initCause(exception);
    } else if (exception instanceof NoRouteToHostException) {
      return (NoRouteToHostException)new NoRouteToHostException(
           "Call to " + addr + " failed on NoRouteToHostException exception: "
                      + exception).initCause(exception);
    } else if (exception instanceof PortUnreachableException) {
      return (PortUnreachableException)new PortUnreachableException(
           "Call to " + addr + " failed on PortUnreachableException exception: "
View Full Code Here

                    if (r.isGateway() && r.isUp()) {
                        return r;
                    }
                }
                // No route found
                throw new NoRouteToHostException(destination.toString());
            } catch (ConcurrentModificationException ex) {
                // The list of entries was modified, while we are searching,
                // Just loop and try it again
            }
        }
View Full Code Here

                    String msg = Messages.getString("rmi.log.116") + host + ':' + port //$NON-NLS-1$
                            + ']';
                    if (proxyTransportLog.isLoggable(RMILog.BRIEF)) {
                        proxyTransportLog.log(RMILog.BRIEF, msg);
                    }
                    throw new NoRouteToHostException(msg);
                }
            } else { // Both direct and HTTP connections are available.
                s = null;
                IOException ex = null;

                try {
                    s = directRsf.createSocket(host, port, (int) connTimeout);
                } catch (IOException ioe) {
                    ex = ioe;
                }

                if (s == null) {
                    // Direct socket attempt failed.
                    if (proxyTransportLog.isLoggable(RMILog.BRIEF)) {
                        // rmi.log.117=Direct socket connection to [{0}:{1}] failed.
                        proxyTransportLog.log(RMILog.BRIEF, Messages.getString(
                                "rmi.log.117", host, port)); //$NON-NLS-1$
                    }

                    if (ex != null) {
                        if ((eagerHttpFallback
                                && !(ex instanceof SocketException))
                                || (!eagerHttpFallback
                                    && !(ex instanceof UnknownHostException)
                                    && !(ex instanceof NoRouteToHostException))) {
                            throw ex;
                        } else {
                            if (proxyTransportLog.isLoggable(RMILog.VERBOSE)) {
                                // rmi.log.118=Trying proxy connection to [{1}:{1}].
                                proxyTransportLog.log(RMILog.VERBOSE,
                                        Messages.getString("rmi.log.118", //$NON-NLS-1$
                                        host, port ));
                            } // Falling through to HTTP connection attempt.
                        }
                    } else {
                        // rmi.95=Connection to [{0}:{1}] timed out
                        throw new NoRouteToHostException(Messages.getString("rmi.95", //$NON-NLS-1$
                                host, port));
                    }
                } else if (proxyTransportLog.isLoggable(RMILog.BRIEF)) {
                    // rmi.log.11A=Direct socket connection to [{0}:{1}] from port {2} succeeded.
                    proxyTransportLog.log(RMILog.BRIEF,
                            Messages.getString("rmi.log.11A", new Object[]{host, port, s.getLocalPort()})); //$NON-NLS-1$
                }
            }
        }

        // Either disableDirectSocket or fallback from direct connection attempt.
        if (s == null) {
            s = proxyRsf.createSocket(proxy, host, port);

            if (s == null) {
                // rmi.log.11B=Proxy connection to [{0}:{1}] failed
                String msg = Messages.getString("rmi.log.11B", host, port); //$NON-NLS-1$
                if (proxyTransportLog.isLoggable(RMILog.BRIEF)) {
                    proxyTransportLog.log(RMILog.BRIEF, msg);
                }

                throw new NoRouteToHostException(msg);
            }

            if (proxyTransportLog.isLoggable(RMILog.BRIEF)) {
                // rmi.log.11C=Proxy connection to [{0}:{1}] from port {2} succeeded.
                proxyTransportLog.log(RMILog.BRIEF,Messages.getString("rmi.log.11C", //$NON-NLS-1$
View Full Code Here

            return new Socket(proxyHost, proxyPort);
        } else if (enableDirect) {
            return new Socket(host, port);
        } else {
            // rmi.81=HTTP proxy is not set
            throw new NoRouteToHostException(Messages.getString("rmi.81")); //$NON-NLS-1$
        }
    }
View Full Code Here

              + " failed on socket timeout exception: " + exception
              + ";"
              + see("SocketTimeout"))
          .initCause(exception);
    } else if (exception instanceof NoRouteToHostException) {
      return (NoRouteToHostException) new NoRouteToHostException(
          "No Route to Host from  "
              + localHost + " to " + destHost + ":" + destPort
              + " failed on socket timeout exception: " + exception
              + ";"
              + see("NoRouteToHost"))
View Full Code Here

                    }

                    @Override
                    protected int write(NioSession session, IoBuffer buf,
                            int length) throws Exception {
                        throw new NoRouteToHostException(
                                "No Route To Host Test");
                    }

                });
        connector.setHandler(new IoHandlerAdapter());
View Full Code Here

                proc.wakeup();
            }

            @Override
            protected int write(NioSession session, IoBuffer buf, int length) throws Exception {
                throw new NoRouteToHostException("No Route To Host Test");
            }
        });
        connector.setHandler(new IoHandlerAdapter());

        IoAcceptor acceptor = new NioSocketAcceptor();
View Full Code Here

  public void test_Constructor() {
    // Test for method java.net.NoRouteToHostException()

    try {
      if (true)
        throw new NoRouteToHostException();
    } catch (NoRouteToHostException e) {
      return;
    }
    fail("Failed to generate expected exception");
  }
View Full Code Here

TOP

Related Classes of java.net.NoRouteToHostException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.