How to keep connection alive in Java 11 http client

后端 未结 2 965
青春惊慌失措
青春惊慌失措 2020-12-17 03:27

I\'m using the Java 11 HttpClient with HTTP/2 and need to keep connection alive for few minutes, but the builder does not have the option to set it. Is there a

2条回答
  •  猫巷女王i
    2020-12-17 04:16

    Both HTTP/2 and HTTP/1.1 connections are kept alive by default. There are some exceptions when several concurrent connections are opened to the same host - then only one of them will be kept alive.

提交回复
热议问题