How to terminate Rest Assured connection in case no response received after period of time - rest-assured

I am using Rest Assured 4 to test our product.
In some cases, rest connection of a single request lasts more then an hour.
I would like to terminate a connection in case no response of any king is back after some period of time.
any way to do that?
thanks

Related

Increase Twilio Total Timeout from 15000ms - SMS

When an API call is made after receiving an SMS via Twilio, I occasionally get the error below -
Error: Total timeout is triggered. Configured tt is 15000ms and we attempted 1 time(s)
The API call occasionally takes longer than 15 seconds to return a response (this is due to having to process the SMS etc.). How can I configure the total timeout to say 25000ms?
It is possible to override the timeout settings for a webhook. However, the maximum total time (tt) for webhooks is 15 seconds and you cannot increase it beyond there.
If you find your service cannot respond within that time, you might want to hand off the processing of the SMS to a job and respond to the webhook quicker. If you then intend to reply to the SMS, you can do so using the REST API message resource instead of TwiML.

First http request in iOS networking is slow, subsequent requests are much faster

I'm experiencing slow response times for my first http POST request to my server.
This happens both in Android and iOS networking libraries. (Volley on Android, and Alamofire in iOS).
First response is roughly 0.7s-0.9s, whereas subsequent requests are 0.2s.
I'm guessing this is due to the session being kept-alive by the server, therefore eliminating the need for establishing a new session on each request.
I figure I can make a dummy request when the app starts to start the session, but it doesn't seem very elegant.
I also control the server side (Node.js) so if any configuration needs to be done there I can also try it.
Investigating a little further, I tried sending an https CONNECT request before issuing the first "real" POST request, and the behavior replicates.
After 30 seconds or so, the connection is dropped (probably at the iOS URLSession level, the load balancer is configured to keep connections as 60 seconds).
In theory this makes sense because setting up an https connection takes up several (12 total) packets and I'm on an inter continental connection.
So my solution is to send a CONNECT request when I expect the user to send a regular request.

How to handle situation if message will not come in queue after timeout. Is it possible with Message Broker?

I think I described almost everything I need in title. So there is some WMB flows. And one wait for the answer in queue. I need to throw exception if there will be no message in queue after timeout.
Thank you for your time
Yes it is possibe, but you will need to develop it in your flows. MQ is made for asyncronous communication, so a timeout is not something which is native to it. I can think of 2 possible solutions now:
Use the TimeoutControl and TimeoutNotification nodes in your flows
In the flow which sends the request, after sending the request you add a TimeoutControl node and set up the desired timeout.
Create a new flow, which starts with the TimeoutNotification flow. In that flow you send your timeout error if the response has not yet been received.
And to know which response has been received you can use different methods, for example the flows sending the request and receiving the response could maintain a database table, or you could store this information in a queue as well.
Start waiting for the response after sending the request
Set up the response handler flow to start with an MQ Input followed by an MQ Get node. You listen for the response with the MQ Get, on which you can set a wait interval, that will be your timeout threshold. The MQ Input gets technical messages sent by the request sender flow after sending the request.
This is a worse solution then the first, as you will block a message flow thread while listening for the response.
Or you can just make 1 flow to send the request and receive the response, receiving the response with an MQ Get node.
This is even worse as you will need to turn off transactionality for the MQ Output sending the request.

How to resolve timeout issues between 2 applications ?

My application is communicating with a service. The service provides user login , registration , update functionality (IAM Service) . Since, this feature is critical & we don't want to impact user performance, we set the timeout 500 millisec, considering the fact that both my application & the IAM service are in the same data center.
On analysis, we found that the IAM service on an average takes 10 - 12 millisecs & my application which simply sends the request takes 1 - 2 millisecs. Also, it does not happen for every request, just a few request.
The network engineer says the network is good & there are no leaks.
Request your inputs to understand, how should I proceed to analyze the root cause to recognize which component is taking time.
Make sure the Application and the Service are synchronized (have the same time stamp)
Log the Time stamp of request being sent by the App
Observe the time stamp when the request hits the wire
Log the Time stamp when the Request is being received by the Service
Log the time stamp when the Service sends out the response
Observe the time stamp when the response hits the wire
Log the time stamp when the app receives the response
The next time the timeout occurs - check the log to find out which two laterally adjacent time stamps have a difference of more than the 500ms. Now once you have the profiled information - focus on the particular segment that causes the timeout.

NSTimer and server response

I'm developing a messaging app and I have to make a call to a server every x seconds to load from server the new messages.
I use a NSTimer that calls the server every x sec.
But for instance x = 1 sec and the response from server arrives after 1,5 sec. In this case I have one new request to the server that comes before that the previous request is satisfied, and this is a big problem for my app's logic. Can you help me to understand how can I check cyclically the messages on the server without have this problem?
Thank you.
Stop your timer before starting your web request, and then start it again when you get your answer.
You can send request to the server and once you have response (success/failure) send another one. In this scenario you will be sure that just one request is send and you can handle it easily.

Resources