Disable SIGPIPE on OS X upon socket creation.

This is done via setsockopt as it OS X does not support MSG_NOSIGNAL.

Review: https://reviews.apache.org/r/18001