Getting the error " j.i.IOException: Premature close "

219 Views Asked by At

I had the following code

public class ComputerDatabaseSimulation extends Simulation {
    HttpProtocolBuilder httpProtocol =
        http.baseUrl("http://atominik.com")
    .proxy(Proxy("m1-resolver.hsenidmobile.com",443));
ScenarioBuilder proxyScenario = scenario("Proxy Request")
        .exec(http("Proxy Request")
                .get("/")
                .check(status().is(200))
                .check(bodyString().saveAs("responseBody"))
        ).exec(session -> {
                    System.out.println(session.getString("responseBody").toString());
                    return session;
                }
        );
   {
       setUp(
            proxyScenario.injectOpen(rampUsers(10).during(10))
        ).protocols(httpProtocol);
   }
}
1

There are 1 best solutions below

0
Stéphane LANDELLE On

"Premature close" means that the server abruptly closed the socket after the HTTP request was sent but before any HTTP response was received.

Your issue is most likely that your proxy is closing the connection, trying to use it for a request over clear HTTP while using its 443 port, hence HTTPS.

I guess that if you really want to target "http://atominik.com", you have to use the port 80 for your proxy.