[iofactory] Refactor

This allows reading of the 'normal' environment variables on Windows,
with behavior similar to what is on Unix

The massive code additions were for making these features reasonably
testable and accessible from the API. While an environment variable
might be a trivial thing, it's quite difficult to figure out what's
wrong when all you have to work with is an environment variable; so
included are tests which should work on both Unix and Win32 with similar
semantics.

Change-Id: I0ab1c1b1b646233bae1308b892d3500069289de8
Reviewed-on: http://review.couchbase.org/28048
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>