Fixed flaky ContenderDetectorShutdownNetwork test.

From: Jiang Yan Xu <yan@jxu.me>
Review: https://reviews.apache.org/r/15868
Merge remote-tracking branch 'upstream/master'
added plenty of ifdef guards to account for TR1 / C++11 and libc++ issues -- this is becoming increasingly nasty and will be hard to maintain -- got some better ideas on how to solve the issue?
added plenty of ifdef guards to account for TR1 / C++11 and libc++ issues -- this is becoming increasingly nasty and will be hard to maintain -- got some better ideas on how to solve the issue?