Class Ping

java.lang.Object
com.squareup.okhttp.internal.spdy.Ping

public final class Ping
extends Object
A locally-originated ping.
  • Method Summary

    Modifier and Type Method Description
    long roundTripTime()
    Returns the round trip time for this ping in nanoseconds, waiting for the response to arrive if necessary.
    long roundTripTime​(long timeout, TimeUnit unit)
    Returns the round trip time for this ping in nanoseconds, or -1 if the response was cancelled, or -2 if the timeout elapsed before the round trip completed.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • roundTripTime

      public long roundTripTime() throws InterruptedException
      Returns the round trip time for this ping in nanoseconds, waiting for the response to arrive if necessary. Returns -1 if the response was cancelled.
      Throws:
      InterruptedException
    • roundTripTime

      public long roundTripTime​(long timeout, TimeUnit unit) throws InterruptedException
      Returns the round trip time for this ping in nanoseconds, or -1 if the response was cancelled, or -2 if the timeout elapsed before the round trip completed.
      Throws:
      InterruptedException