Java – simulate P2P network traffic on a computer
What is the best way to simulate a network in Java?
I am in the early stage of the network peer-to-peer project and have determined some necessary features of the client. I hope to be able to simulate 100 instances on my PC at the same time
Ideally, I want to create an "analog" version of sockets that have their own input and output streams Finally, I will use these streams for data transfer, rather than just moving data between Java objects, so what I want to simulate is latency, data loss and other errors you may encounter in the actual network
Ideally, these simulation methods would be very close to Java net.* So I don't need a lot of rewriting to move from the simulation to the actual client
Who can point me in the right direction?
Solution
You can use akka to create millions of actors on a computer and then organize communication between them similar to a "real" network
This is an example project: https://github.com/adelbertc/scalanet