square/okhttp — pull request #1007 by dlubarov (2014-07-29 22:22:29+00:00)
Title: Option to connect to all IPs behind a hostname in parallel.

This introduces a `ConnectionStrategy` interface for creating connections to a `Route`. The default `SimpleConnectionStrategy` implemention preserves the old behavior, passing along hostnames to Socket which will chose one of the underlying IPs. The `ParallelConnectionStrategy` implementation will initiate a TCP handshake to each IP concurrently and return the first connection to complete.

I tested `ParallelConnectionStrategy` with our API endpoint and got the datacenter I'm close to, as expected, and the time it look was comparable to my RTT to that datacenter (5-15ms in most cases).

Somewhat related to issue #506 (Happy Eyeballs).