The org.jboss.resteasy.plugins.server.sun.http.SunHttpJaxrsServer uses the com.sun.net.httpserver.HttpServer as the backing server. The HttpServer.stop(int) method was set to use 0 for the delay. On Windows this seems to take longer to actually close than expected. During tests there may be an attempt to start a new server before the previous one actually closes the connection.
There are two ways this could be fix.
- We use an arbitrary 10 second delay like the VertxJaxrsServer does.
- We support a timeout passed to the constructor which would then be passed as the delay to the HttpServer.stop() method.
- Note That if we use this approach it should likely be supported for the other EmbeddedJaxrsServer's