Package java.net

Examples of java.net.NoRouteToHostException


     */
    public void test_ConstructorLjava_lang_String() {
        // Cannot test correctly without changing some routing tables !!
        try {
            if (true) {
                throw new NoRouteToHostException("test");
            }
            fail("Failed to generate expected exception");
        } catch (NoRouteToHostException e) {
            assertEquals("Threw exception with incorrect message", "test", e
                    .getMessage());
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

                proc.wakeup();
            }

            @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 {
                return proc.isBrokenConnection();
View Full Code Here

      yieldFlag = YIELD_CONNECT;
      if (log.isTraceEnabled()) {
        log.trace("show connect stack trace for debug", new Exception("DEBUG USAGE"));
      }
      if (status == NginxClojureAsynSocket.NGX_HTTP_CLOJURE_SOCKET_ERR_RESOLVE) {
        throw new NoRouteToHostException(as.buildError(status));
      }else if (status == NginxClojureAsynSocket.NGX_HTTP_CLOJURE_SOCKET_ERR_CONNECT) {
        throw new PortUnreachableException(as.buildError(status));
      }else if (status != NginxClojureAsynSocket.NGX_HTTP_CLOJURE_SOCKET_OK) {
        throw new ConnectException(as.buildError(status));
      }
View Full Code Here

    throw new ConnectException("Invalid destination port");
   String message = getSocketErrorMsg0(res);
   if (isSocketErrConnRefused0(res) != 0)
    throw new ConnectException(message);
   if (isSocketErrHostUnreach0(res) != 0)
    throw new NoRouteToHostException(message);
   throw new SocketException(message);
  }
  return isConnected;
}
View Full Code Here

  {
   String message = getSocketErrorMsg0(res);
   if (isSocketErrAddrNotAvail0(res) != 0)
    throw new BindException(message);
   if (isSocketErrHostUnreach0(res) != 0)
    throw new NoRouteToHostException(message);
   if (isSocketErrResetConn0(res) != 0)
    throw new PortUnreachableException(message);
   throw new SocketException(message);
  }
}
View Full Code Here

  }

  @Test
  public void testException() throws Throwable {
    Exception e =
        new NoRouteToHostException("that box caught fire 3 years ago");
    ThrowableInformation ti = new ThrowableInformation(e);
    Log4Json l4j = new Log4Json();
    long timeStamp = Time.now();
    String outcome = l4j.toJson(new StringWriter(),
        "testException",
View Full Code Here

  }

  @Test
  public void testNestedException() throws Throwable {
    Exception e =
        new NoRouteToHostException("that box caught fire 3 years ago");
    Exception ioe = new IOException("Datacenter problems", e);
    ThrowableInformation ti = new ThrowableInformation(ioe);
    Log4Json l4j = new Log4Json();
    long timeStamp = Time.now();
    String outcome = l4j.toJson(new StringWriter(),
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 (cause instanceof ConnectException) {
                Throwable newT = new ConnectException(cause.getMessage() + ": " + remoteAddress);
                newT.setStackTrace(cause.getStackTrace());
                cause = newT;
            } else if (cause instanceof NoRouteToHostException) {
                Throwable newT = new NoRouteToHostException(cause.getMessage() + ": " + remoteAddress);
                newT.setStackTrace(cause.getStackTrace());
                cause = newT;
            } else if (cause instanceof SocketException) {
                Throwable newT = new SocketException(cause.getMessage() + ": " + remoteAddress);
                newT.setStackTrace(cause.getStackTrace());
                cause = newT;
            }

            return cause;
        }
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.