On Mon, 2018-02-19 at 18:52 +0000, COURTAULT Francois wrote: > Hello Oleg, > > Our test case is asynchronous and our test requires that the testing > entity has to be an HTTP client and an HTTP server but not at the > same time. > > 1) Our testing entity, as an HTTP client, sends a request to our > product. > 2)Then asynchronously, after a certain amount of time, the product > sends an HTTP request to our testing entity (HTTP server) > 3) The testing entity has to check the request received . Test is OK > if the payload received matches the expected payload and KO if not. > In this configuration, this is up to the HTTP server to > determine if the test is OK or KO. > > Is it clear ?
Sort of. It is still unclear why the server could not return KO status to the client instead of shutting down. We do a lot of integration tests using HttpCore embedded server but there was never a need to to let the server go down without sending back a response to the client https://github.com/apache/httpcomponents-client/tree/4.5.x/httpclient/s rc/test/java/org/apache/http/impl/client/integration > > We have to perform this several times and have to set a test result > each time => this is why we have to shut down the HTTP server > after receiving a bad or good HTTP request. > > > When you said "throwing an unchecked (runtime) exception", where do > we have to do this ? In the HttpRequestHandler.handle method ? > But in such case, will the product received the entire HTTP response > ? > Yes, from the handler method. > BTW, I have another question about HTTPServer shutdown method which > takes a grace period as an argument. > I haven't found so much explanation looking at the java doc. So, > could you explain me please, what is the meaning of this grace period > ? It is a period of time when the server stops accepting new connections but allows active connections to complete ongoing exchanges. > If we want to perform a hard shut down, do we have to set this value > to 0 ? Yes. > Do we have to perform a stop + shutdown HTTPServer calls or a > shutdown call is sufficient ? > #shutdown should be enough. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
