This is a simple test page to demonstrate the issue.
It turns out that the Java behavior is so bad that I cannot even imitate it in PHP!
Fortunately Node JS provides lower-level access to HTTP so I could create a test server that imitates the Java behavior: etag.js.