HTTP Connection KeepAlive doesn't work!
Hello,
why the KeepAlive-Feature (reusing of TCP-connections, described at http://java.sun.com/j2se/1.5.0/docs/guide/net/http-keepalive.html) doesn't work in the following example? I'm using J2SE 1.4...
import java.net.HttpURLConnection;
import java.net.URL;
public class Test {
public static void main(String[] args) {
try {
for (int i=0; i<5; i++) {
URL url = new URL("http://www.sun.com/");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.connect();
conn.getContent();
conn.disconnect();
}
} catch (Exception e) {
System.err.println("Exception: "+e.getMessage());
}
}
}
I've checked with Ethereal (http://www.ethereal.com), that 5 different TCP-connections are used, when this example runs.
Where is my mistake?
Does KeepAlive works with MIDP 1.0?
Slavik

