The default behavior for OkHttpClient is to set keep-alive to true. For our specific use case, I need to set this to false.
I am not finding any setting in the Java source to do this.
Has anyone run into this?
I am on OkHttpClient 3.8.1
Thanks
The default behavior for OkHttpClient is to set keep-alive to true. For our specific use case, I need to set this to false.
I am not finding any setting in the Java source to do this.
Has anyone run into this?
I am on OkHttpClient 3.8.1
Thanks
according to https://github.com/square/okhttp/issues/2031
u can run demo code like
okHttpClient.setConnectionPool(new ConnectionPool(0, 0));
or add header like Connection: close.
The source code which give you a clue to this behavior is: https://github.com/square/okhttp/blob/480c20e46bb1745e280e42607bbcc73b2c953d97/okhttp/src/main/kotlin/okhttp3/internal/connection/RealConnectionPool.kt#L108