Hello Oleg,
Thanks a lot for your answers.
But there is still something unclear for me.
When you said that I am able to throw an unchecked exception in the handle
method. In this case:
- does it means that the server will be shutdown automatically ?
- will the HTTP response be received by our product ? (don't think so but
prefer to check with you)
Best Regards.
-----Original Message-----
From: Oleg Kalnichevski [mailto:[email protected]]
Sent: mardi 20 février 2018 12:30
To: HttpClient User Discussion <[email protected]>
Subject: Re: Advice when using HttpServer for testing purpose
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://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fhttpcomponents-client%2Ftree%2F4.5.x%2Fhttpclient%2Fs&data=02%7C01%7CFrancois.Courtault%40gemalto.com%7Cf4d418478ca6446e133208d578564244%7C37d0a9db7c464096bfe31add5b495d6d%7C1%7C0%7C636547234230139869&sdata=QI0AAG1youwZW9AmtkVPmXEfcgKd%2FO4uYDEf6xJ4maU%3D&reserved=0
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]
________________________________
This message and any attachments are intended solely for the addressees and
may contain confidential information. Any unauthorized use or disclosure,
either whole or partial, is prohibited.
E-mails are susceptible to alteration. Our company shall not be liable for the
message if altered, changed or falsified. If you are not the intended recipient
of this message, please delete it and notify the sender.
Although all reasonable efforts have been made to keep this transmission free
from viruses, the sender will not be liable for damages caused by a transmitted
virus.