Extract proxy/config common functions for reuse

Refactor proxy to use the common config.  This is a prereq for #356 and the commits 
have had feedback from @thockin only.
Also fix tests.
Convention to force it to only reference public methods - described a bit here http://stackoverflow.com/questions/19998250/proper-package-naming-for-testing-in-go-lang but it's fairly common.