(steal from Ping.java, which has Square's copyright)