Is there any way to introduce fake delay in Java RMI calls?

Want to diagnose a bottleneck that occurs when my client is talking to a server on the other side of the world. I would like to start the server on my local machine and simulate latency. Is there a way that I can insert a short stream during all remote calls? I'm not sure which remote call is the bottleneck, so I need to defer all of them.

The second attempt to clarify:. I do not want to copy thread inserts into each individual remote method, because there are many, many remote methods. I am trying to find a way to introduce sleep into the RMI subsystem, so all RMI calls will be deferred.

+4
source share
5 answers

WANem is designed for this. It works at the network level, so it does not depend on Java or RMI.

+7
source

The Charles Proxy server has a function in which it can add throttling / latency to the connection:

http://www.charlesproxy.com/documentation/proxying/throttling/

I was very pleased with Charles - it costs $ 50 per license.

+1
source

Can you write a proxy server? The client talks to the proxy server, the proxy server makes the same method call on the server. Thus, you reconfigure the client, but do not need to change the code. A proxy server can add delays and record calls and responses.

0
source

There is a Windows application called SoftPerfect Connection Emulator. Simulates delay and, if necessary, loss or bandwidth limitation. See http://www.softperfect.com/products/connectionemulator/

0
source

A delay can be introduced by injecting and entering your own RMISocketFactory by calling setSocketFactory .

0
source

All Articles