1

I am using this method to set CONNECTION_TIMEOUT and SO_TIMEOUT

public void setConfig(ContentType contentType, Integer timeout) {
            setConfig(SerenityRest.config()
                    .sslConfig(new SSLConfig().allowAllHostnames().relaxedHTTPSValidation())
                    .httpClient(HttpClientConfig.httpClientConfig()
                    .setParam(CoreConnectionPNames.CONNECTION_TIMEOUT, timeout)
                    .setParam(CoreConnectionPNames.SO_TIMEOUT, timeout)))
                    .addHeader(HttpHeaders.CONTENT_TYPE, contentType.toString());
        }
khadjolees
  • 11
  • 1

1 Answers1

0

org.apache.http.params.CoreConnectionPNames is deprecated and the class was removed. This prevents you from using the pre-made constants.

According to Android Developer Reference for CoreConnectionPNames:

  • The String value for SO_TIMEOUT was "http.socket.timeout".
    • according to the JavaDocs, replacement guidance references java.net.SocketOptions.SO_TIMEOUT, but this is an int so this may not be proper guidance
  • The String value for CONNECTION_TIMEOUT was "http.connection.timeout".
    • there is no replacement guidance

Substituting these for the constants or creating your own constants can replace the original constants; however there is no guarantee these settings will be recognized going forward. This SO answer should provide guidance on how to proceed forward modernizing the timeout.

Broad guidance is to swap to applying org.apache.http.client.config.RequestConfig.

RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout).build();
JoshDM
  • 4,939
  • 7
  • 43
  • 72