Simulating slow communications in Java

I am integrating two java web applications that are implemented in slightly different ways - one uses servlets, the other uses Jersey Restful APIs. The first application is the front end and that communicates with the Restful service for data. I want to simulate communication delays between the web front end and the servlets and between the servlets and the Restful apis.

I have access to the code for both apps but I am hoping I can put the delay on communications in and out of the servlet.

Is there some way to get in front of the communications and delay it being passed to the rest of the app (and the other way round..)
Who is Participating?
CEHJConnect With a Mentor Commented:
A simplistic implementation could be to use a ServletFilter and use Thread.sleep
ValeriConnect With a Mentor Commented:
You can use this. there is no need to change code.

this is also an option:
MWilliamsBoltonAuthor Commented:
Thanks to both for the guidance
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.