I got very similar behaviour as described in HttpURLConnection getInputStream() has one second delay: getting the InputStream of a http-connection in Java causes a delay at least 500ms. InputStreams were closed properly. Using the apache httpclient implementation resolves the problem, too. Unfortunaltely, the replacement is not suitable in each of my use cases.
Additionally, the delay does not show up in every setting. The observations i made so far are as follows:
- Using the httpclient library works like a charm
- Using Windows Server 2012 R2 on the server side does not cause delays neither with W7 Professional nor W7 Enterprise
- Java version on client side does not matter (32bit/64bit, 7/8)
- Using Windows 7 Enterprise or Linux on the client side works like a charm
- Using Windows 7 Professional on the client side and a Linux box on the host side causes (at least) 500ms delays
Futhermore, it is no solution to condemn Linux on the server side wholesale as somewhere else, the problem does not show up using the Windows 7 Professional edition.
I monitored the network traffic with wireshark to find differences without success: the delay happens on the client side after the response got received entirely.
Finally, the question(s): exists a limitation in (the network stack of) Windows 7 Professional that causes this behaviour? Is it possible to tweak the Windows settings so the delay does not happen?