Can't send request using Http/2 and prior knowledge

I am trying to load test a backend service that is listening using Http/2. In particular, the server is configured to use:

  • Clear text
  • Prior knowledge with no support for protocol upgrade
    This means that I can send a request to the server using:

curl--http2-prior-knowledge http://localhost:8088/data.txt

Now, I can’t manage to make the simulation below works:

`

import io.gatling.core.Predef.{Simulation, scenario, _}

import io.gatling.http.Predef.{http, status, _}

import scala.concurrent.duration._

class TestSimulation extends Simulation {
val httpProtocol = http
.baseUrl(“http://127.0.0.1:8088”)
.enableHttp2
.http2PriorKnowledge(
Map(
“127.0.0.1:8088” → true,
// “127.0.0.1” → true,
)
)

val request =
http(“Http/2 Scenario”)
.get("/data.txt")

val s =
scenario(“HTTP2 scenario”)
.exec(
request
.check(status.is(200))
)

val run = setUp(s
.inject(
constantUsersPerSec(1) during (1 seconds))
.protocols(httpProtocol))
}

`

The request simply isn’t sent. I checked with Wireshark and Gatling is not even trying to send a HTTP/2 request, this is the output:

`

GET /data.txt HTTP/1.1
accept: /
host: 127.0.0.1:8088

`

So I guess I am missing something or there is a bug. But in any case case, I can’t find a complete example online.

To reproduce you can use the server below:

`
nghttpd --no-tls --verbose --color -a localhost 8088

`

Also, using

java -version
openjdk version “11.0.6” 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Ubuntu-1ubuntu119.10.1)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Ubuntu-1ubuntu119.10.1, mixed mode, sharing)

compile “io.gatling.highcharts:gatling-charts-highcharts:3.3.1” // Main plugin with Gatling code

Any idea ?

Real HTTP/2 requires https.
Gatling doesn’t support h2c atm, only h2.

Ahh, Ok, I see. That explains the issue.

Thanks a lot for the quick response.