@Before
 public void clearJvmHttpAuthCaches() {
   // FIXME: this is circumvention got from here:
   // http://stackoverflow.com/questions/480895/reset-the-authenticator-credentials
   // Actual Java bug is this: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6626700
   sun.net.www.protocol.http.AuthCacheValue.setAuthCache(
       new sun.net.www.protocol.http.AuthCacheImpl());
 }
 private void prepareAuthentication() {
   // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6626700
   // The credentials from earlier requests are cached, and used if
   // the current ones doesn't work!!!
   AuthCacheValue.setAuthCache(new AuthCacheImpl());
   if (username != null && password != null) {
     Authenticator.setDefault(new HTTPBasicAuthenticator(username, password));
   }
   // remove the current entry
   else {
     Authenticator.setDefault(null);
   }
 }