I have found a solution, just add the
AllowChunking="false"
in the request header. Specifically, I am using the apache cxf framework, and the default value of "AllowChunking" is true (see the ref). If it is set to false, cxf will add the content-length to the header when sending the request, so that the connection will not be closed when writing the request body.