Gradle sonarqube scan fails with cannot connect to sonarqube error

I am testing out the sonarqube gradle feature where I am trying to run a sonarscan using gradle.
I took the steps from here
I cloned the sample project, added my proxy for firewall, added sonarqube instance and sonar token, but still my scan fails with the error.

Task :sonarqube FAILED
SonarQube server [http://sonarqubehost:9000] can not be reached

I am running the task as

./gradlew -Dsonar.sonar.token=xxxxx sonarqube

My files are as follows

cat build.gradle
plugins {
id “org.sonarqube” version “3.3”
I also added this line in, just to try

i generated the token for admin user.
Can someone please tell me what am I doing wrong?

Hey there.

Are you sure you can access the SonarQube server from the system you’re running Gradle? A simple ‘curl’ command should tell you as much.

I had to add organisation specific proxy settings in settings.gradle file and it worked.