Skip to content

Instantly share code, notes, and snippets.

@diegopacheco
Last active August 24, 2022 16:05
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save diegopacheco/31091f9c507b9c78128e73b48f2ce08a to your computer and use it in GitHub Desktop.
Save diegopacheco/31091f9c507b9c78128e73b48f2ce08a to your computer and use it in GitHub Desktop.
Gatling: Hot fo fix: "java.net.ConnectException: Cannot assign requested address"?
  val httpConf = http
    .baseURL("http://IP:9200")
    .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
    .doNotTrackHeader("1")
    .acceptLanguageHeader("en-US,en;q=0.5")
    .acceptEncodingHeader("gzip, deflate")
    .userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0")
    .shareConnections

pre-tunning: https://github.com/gatling/gatling/blob/master/src/sphinx/general/operations.rst

.shareConnections does the magic! https://groups.google.com/forum/#!topic/gatling/rRpv8LPa51I

@BadriAhmed
Copy link

I know my comment is 2 years late,
Just as mentioned in the google group, the "shareConnections" parameter can falsify your tests, it means that you are testing a server to server connection, not client to server connections, so be careful while using it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment