Cache the proxy username and password

Fixes #967.