I am using RestAssured for API automation. We have a huge application with so many api calls. So, what could be better way to close the connection after response has been received properly. In that way, I will not be worried about connection leakage.
Below is my code:
RestAssuredConfig restAssuredConfig = RestAssured.config().encoderConfig(EncoderConfig.encoderConfig().appendDefaultContentCharsetToContentTypeIfUndefined(false)).httpClient(HttpClientConfig.httpClientConfig().setParam("http.connection.timeout", 60000).setParam("http.socket.timeout", 300000).setParam("http.conn-manager.timeout", 300000));
RequestSpecification requestSpecification = RestAssured.given().config(restAssuredConfig).relaxedHTTPSValidation();
Should I specify ConnectionConfig like below ?
RestAssured.config().connectionConfig(ConnectionConfig.connectionConfig().closeIdleConnectionsAfterEachResponse());
Should I use closeIdleConnectionsAfterEachResponse() method ? or closeIdleConnectionsAfterEachResponseAfter(long idleTime, TimeUnit timeUnit) method ?
Please help. Thanks in advance.