When sending an HTTP request using HttpClient, the server receives the transaction only after 3 seconds of basic time.
The logs are as follows:
2017-12-25 09:08:26,001 [http-nio-8080-exec-8] DEBUG o.a.h.wire-http-outgoing-322 >> "connection:keep-alive[\r ][\n] "
2017-12-25 09:08:26,001 [http-nio-8080-exec-8] DEBUG o.a.h.wire-http-outgoing-322 >> "user-agent: apache-httpclient/4.5.1 (java/1.8.0_144) [\r][\n] "
2017-12-25 09:08:26,001 [http-nio-8080-exec-8] DEBUG o.a.h.wire-http-outgoing-322 >> "expect:100-continue[\r][ \ n] "
2017-12-25 09:08:26,001 [http-nio-8080-exec-8] DEBUG o.a.h.wire-http-outgoing-322 >> "Accept-encoding:gzip, Deflate[\r][\n] "
2017-12-25 09:08:26,001 [http-nio-8080-exec-8] DEBUG o.a.h.wire-http-outgoing-322 >> "[\r][\n]"
2017-12-25 09:08:26,353 [nioeventloopgroup-700-1] DEBUG i.n.b.poolthreadcache-freed 1 thread-local buffer (s) from Threa D:nioeventloopgroup-700-1
2017-12-25 09:08:27,986 [nioeventloopgroup-701-1] DEBUG i.n.b.poolthreadcache-freed 2 thread-local buffer (s) from Threa D:nioeventloopgroup-701-1
2017-12-25 09:08:29,005 [http-nio-8080-exec-8] DEBUG o.a.h.wire-http-outgoing-322 << [read] I/O error:read timed Out
=============================================================================================================== ========
To this, looked up the source error message, also did not locate the cause of the problem. Later or by looking at the log, in the error before there is a section of "expect:100-continue[\r][\n", and then looked at the HTTP 1.0 and 1.1 protocol, and combined with the analysis of the packet capture, it dawned. HTTP 1.1 supports sending only header information (without any body information) and returns 100 if the server thinks the client has permission to request the server, otherwise 401. The client will only start sending the request body to the server if it accepts 100.
After that, you can send and receive an answer as soon as you change the HTTP protocol to 1.0
Reference: Https://www.ietf.org/rfc/rfc2616.txt
http://blog.csdn.net/kingcodexl/article/details/51306062
http://blog.csdn.net/linsongbin1/article/details/54980801