Mirrors the API that does this for Sockets. Bug: 18076907 Change-Id: Ifa27b39e23797558546aab751fbfb3aed3b7dbcb