The javax.ws.rs.sse.SseEventSource javadoc states the onError "Throwable consumer is invoked upon a unrecoverable error encountered by a SseEventSource". It also states the following:
"In addition to handling the standard connection loss failures, JAX-RS SseEventSource automatically deals with any HTTP 503 Service Unavailable responses from an SSE endpoint, that contain a "Retry-After" HTTP header with a valid value. ... In case a HTTP 503 + "Retry-After" response is received in return to a connection request, JAX-RS SSE event source will automatically schedule a new reconnect attempt and use the received "Retry-After" HTTP header value as a one-time override of the reconnect delay."
The current implementation in Resteasy does perform the reconnect/re-try specified. However in addition to this, it also produces an onError event and sends this to the registered Throwable consumers. This is not correct behavior. OnError events should only be sent upon unrecoverable errors that occur during event processing.
The org.jboss.resteasy.test.providers.sse.SseReconnectTest.testSseEndpointUnavailable() test currently verifies this incorrect behavior and will need to be fixed when this is addressed.