fix for proxy user with dots or hyphens
fix for os.env proxy without port
added some tests for connections behind proxies
Merge pull request #1781 from gustavorauber/develop

Fixes for general connection behind proxy. Fixes #1781.