Sometimes httpclient is trying http post to server before server accepts it. I don't know which situation it occurs but becuase of this problem posting is failed. Why does client acting like this?
Here is some part of the logs;
DEBUG org.apache.http.wire - >> "POST /destination-path[\r][\n]"
DEBUG org.apache.http.wire - >> "Content-Length: 594[\r][\n]"
DEBUG org.apache.http.wire - >> "Content-Type: application/json[\r][\n]"
DEBUG org.apache.http.wire - >> "Host: url:port[\r][\n]"
DEBUG org.apache.http.wire - >> "Connection: Keep-Alive[\r][\n]"
DEBUG org.apache.http.wire - >> "Expect: 100-continue[\r][\n]"
DEBUG org.apache.http.wire - >> "[\r][\n]"
DEBUG org.apache.http.headers - >> POST /destination-path HTTP/1.1
DEBUG org.apache.http.headers - >> Content-Length: 594
DEBUG org.apache.http.headers - >> Content-Type: application/json
DEBUG org.apache.http.headers - >> Host: url:port
DEBUG org.apache.http.headers - >> Connection: Keep-Alive
DEBUG org.apache.http.headers - >> Expect: 100-continue
DEBUG org.apache.http.wire - >> "data:mydata"
">>" indicates outgoing operation in this log. This means client is sending requests to server to handshake. At last statement, data is being tried to be sent. But it should have waited for server response for this connection. Generally this problem occurs at initial connection. Connections after this failed conection trying , are successfull.
RFC 2616 section 8.2.3:
Because of the presence of older implementations, the protocol allows
ambiguous situations in which a client may send "Expect: 100-
continue" without receiving either a 417 (Expectation Failed) status
or a 100 (Continue) status. Therefore, when a client sends this
header field to an origin server (possibly via a proxy) from which it
has never seen a 100 (Continue) status, the client SHOULD NOT wait
for an indefinite period before sending the request body.
When using the 'expect: continue' handshake Apache HttpClient waits for 2000 ms for a 4xx or 100 status prior to sending the request body. One can use the 'http.protocol.wait-for-continue' parameter to specify a different value.