CBQE-0 fix extract hostname in windows and unix

Change-Id: I973730dd01a5c2e3fee6d57efaa9d589225f8013
Reviewed-on: http://review.couchbase.org/44022
Reviewed-by: Thuan Nguyen <soccon@gmail.com>
Tested-by: Thuan Nguyen <soccon@gmail.com>