Wrong:
myprops.setProperty("http.proxyUserName",userid);
Right:
myprops.setProperty("http.proxyUser",userid);
407 is the proxy authentication error. Proxy is not getting the user name due to the above error. I do think proxyUserName is more appropriate, but like many other things proxyUser - a misnomer is used and people are too lazy to change it.
regards,
Selva.