5

I am trying to provoke a server timeout in an integration test, by placing a sleep loop in my Controller. I do appreciate people wanting to help out, but please don't ask why I am doing this, or suggest better ways of doing what you think I am trying to achieve: I just want to see the timeout happen, or understand why it is not happening.

To do that, I have set connection-timeout to a small value.

server:
  tomcat:
    connection-timeout: 1000

I can see that the socket timeout is set to that small value, in the SocketWrapper, so configuration-wise I think I'm OK.

However in NioEndpoint, I can see that the Poller is failing to evaluate true in this test:

} else if ((socketWrapper.interestOps() & SelectionKey.OP_READ) == SelectionKey.OP_READ ||
      (socketWrapper.interestOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE) {

(This is library tomcat-embed-core:9.0.4.1, Line 951)

And it fails to evaluate to true, because socketWrapper.interestOps() is 0 every time except the first time my breakpoint is activated there, and the first time, the timeout should not occur yet.

Is there anything I can do differently?

Luis Muñiz
  • 4,649
  • 1
  • 27
  • 43

0 Answers0