Why dependency resolution is much slower when setting credentials in a custom maven repo?

I have a Android project that needs to download all dependencies through our local Artifactory, which in turn does not have anonymous access enabled. Here’s part of my script:

buildscript {
    repositories {
        maven {
            url "http://localhost:8081/artifactory/repo"
            credentials {
                username "${artifactory_user}"
                password "${artifactory_password}"
            }
            name = "artifactory-main-repo"
        }
    }
      dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
    }
}
  allprojects {
    repositories {
        maven {
            url "http://localhost:8081/artifactory/repo"
            credentials {
                username "${artifactory_user}"
                password "${artifactory_password}"
            }
        }
    }
}

The problem is that when using the credentials the build takes approximately 5-6 times more time to execute, while testing the same script without the credentials in the same Artifactory configured with anonymous access is pretty fast. When running gradle with --debug I can see a ~5 seconds delay between these calls:

15:21:36.376 [DEBUG] [org.gradle.internal.resource.transport.http.JavaSystemPropertiesHttpProxySettings] Found java system property ‘http.nonProxyHosts’: local|.local|169.254/16|.169.254/16. Will ignore proxy settings for these hosts. 15:21:41.468 [DEBUG] [org.gradle.internal.resource.transport.http.HttpClientConfigurer] Using org.gradle.internal.resource.PasswordCredentials@6ae11764 and NTLM Credentials [user: deployer, domain: , workstation: ] for authenticating against ‘null:-1’

I installed Artifactory in my machine and I get the same results, so I don’t think the problem is network latency nor the server hosting Artifactory.

Do you have any ideas?