-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Okhttp how to send the non - keepalive request #2031
Comments
you can set custom connection pool with zero for maxIdleConnection parameter
note: this is just use case you must declare your connection pool as singleton |
Use the following header: |
Yes, according to your method is ok, thank you! |
@swankjesse I use the code sends the request, see is non - keepalive from the server end, but the reponse header like this: client_h1 = new OkHttpClient();
client_h1.setProtocols(Arrays.asList(Protocol.HTTP_1_1)).setConnectionPool(new ConnectionPool(100,10000));
for (int i = 0; i < request_times; ++i) {
request = new Request.Builder().url(Url)
.addHeader("Connection","keep-alive")
.build();
response = client_h1.newCall(request).execute(); |
@swankjesse I want to use okhttp sends a non - keepalive request, my understanding is okhttp default sends a keepalive request, but I am not sure that's the case, how should I set the non - keepalive?
The text was updated successfully, but these errors were encountered: