Fix threadedhttp imports

urlparse module was being imported on python 2 instead of the function.
urljoin was being imported from httplib2 instead of the core libraries.

Also add test for HTTP 504

Change-Id: Iff85deef564d539b55af3bed5183fd0f090f81e0
Merge "Fix threadedhttp imports"