Steven Venham Steven Venham - 1 year ago 144
HTTP Question

Java http server wont receive more then once

So I got this simple java HTTP server together, (I know about Jetty ext. I need my own.)
I can make requests, receives, and put a response. But only once.
Afterwords, I don't receive anything. Which is odd, iv tried killing the connection after every request, to force a reset but it just does not want anything to do with it.

Chrome Dev Tools:
Chrome Dev Tools

While the console shows:

Trying to bind to localhost on port 8080...OK!

Ready, Waiting for connections...
24.---.---.--- connected to server.
24.---.---.--- requested /index.html ... processed OK.
24.---.---.--- connected to server. (I don't get any data, just times out)

I'm Expecting a request for favicon.ico and get nothing.
Secondly, if I refresh the page, I get another connection that just requests nothing. and Chrome reports:

The 24.---.---.--- page isn’t working
24.---.---.--- didn’t send any data.

Heres the source.


  • Closing the Socket

  • Flushing output

  • Deleting the object

  • Closing all I/o after 1 request.

  • Refactored to use soTimeout to close connection with a timeout.

No idea.

Answer Source

Problem was not with HTTP server.

After looking at it with fresh eyes, the problem was located in my Thread-pool. The pool was processing 1 request then shutting itself down, making it appear to be a HTTP issue.


Does not behave like you would expect, it adds it to the queue, instead of you having to make a loop to pop Runnable objects from a List stack.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download