After upgrading Jetty from the 7 to the 9 branch ( & ), an issue pops up where some BOSH requests will fail.
The direct cause of this issue is that sometimes, the InputStream from the HttpServletRequest returns nothing when being read.
A simplistic work-around for this problem is checking for availability of data (through InputStream.available()) and sleeping for a couple of milliseconds when that returns zero.
The root cause of the issue can be found in usage of the non-async API from an async context. Instead of using the non-async API, the newer async API should be used.
This issue was discussed on the Jetty User mailinglist. The discussion is archived here: http://dev.eclipse.org/mhonarc/lists/jetty-users/msg05552.html
I am working on this issue in this fork: https://github.com/guusdk/Openfire/tree/OF-885
New implementation has been pushed and tested. Pidgin (via BOSH) gives odd behavior, but that was already the case before I applied the changes. Strophe, JSJac and Candy appear to work just fine with the new changes.