Package com.google.gwt.http.client

Examples of com.google.gwt.http.client.RequestTimeoutException


        Caller caller = new Caller();
        caller.setMaxAttempts(3);

        // no attempts made so far (allowed for some exceptions)
        assertFalse(caller.isAnotherAttemptAllowed(null));
        assertTrue(caller.isAnotherAttemptAllowed(new RequestTimeoutException(null, 0)));
        assertFalse(caller.isAnotherAttemptAllowed(new Exception("Hello")));

        // 1 attempt made so far (allowed for some exceptions)
        caller.incrementAttempts();
        assertFalse(caller.isAnotherAttemptAllowed(null));
        assertTrue(caller.isAnotherAttemptAllowed(new RequestTimeoutException(null, 0)));
        assertFalse(caller.isAnotherAttemptAllowed(new Exception("Hello")));

        // 2 attempts made so far (allowed for some exceptions)
        caller.incrementAttempts();
        assertFalse(caller.isAnotherAttemptAllowed(null));
        assertTrue(caller.isAnotherAttemptAllowed(new RequestTimeoutException(null, 0)));
        assertFalse(caller.isAnotherAttemptAllowed(new Exception("Hello")));

        // 3 attempts made so far (disallowed because we've already made the maximum number of retries)
        caller.incrementAttempts();
        assertFalse(caller.isAnotherAttemptAllowed(null));
        assertFalse(caller.isAnotherAttemptAllowed(new RequestTimeoutException(null, 0)));
        assertFalse(caller.isAnotherAttemptAllowed(new Exception("Hello")));
    }
View Full Code Here


        assertNull(caller.result);
    }

    /** Test onUnhandledError() for RequestTimeoutException. */
    @Test public void testOnUnhandledError5() {
        Throwable exception = new RequestTimeoutException(null, 0);
        Caller caller = new Caller();
        caller.onUnhandledError(exception);

        assertEquals("generateRequestTimeoutExceptionError", caller.error.getMessage());
        assertNull(caller.statusCode);
View Full Code Here

  /**
   * Method called when this request times out.
   */
  private void fireOnTimeout(RequestCallback callback) {
    cancel();
    callback.onError(this, new RequestTimeoutException(this, timeoutMillis));
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.http.client.RequestTimeoutException

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.