| www.rodneybeede.com | "I would love to change the world, but they won't give me the source code" - unknown |
After many hours of writing Java socket test code and trying different web servers I discovered the issue. It wasn't related to any of my buffer sizes (I tried all kinds of buffers and sizes).
Turns out that because I didn't initialize log4j (I didn't use it) that the logging mechanism on Windows for HTTPClient was wasting lots of time with internal errors from the library logging code. Turning on trace logging actually made things go faster.
A quick fix since I didn't care about the logging for HTTPClient was to do
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
This disables all logging. You should set this up before creating any HTTPClient instances.