• Post Reply Bookmark Topic Watch Topic
  • New Topic

Emulating client input  RSS feed

 
Siobhan Chom
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a client/server system which I am trying to test by emulating multiple clients, running concurrently:

The input to each client is obtained via the following code:

My problem is that the commands for each client need to be interleaved in a specific fashion, but each client is a standalone JAR. I would normally generate multiple instances of running a program using perl, but can't figure out how to continue entering text in a preopen jar.

Any help would be greatly appreciated
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure I understand what you're asking. It sounds like you want to simulate a user typing on the keyboard. Is that correct?

If so, then don't hardcode System.in. Take an InputStream as a parameter. For your testing, pass it a FileInputStream for a text file of the input you want to simulate, or, if you want to hardcode it all in your source, you can use a StringReader or ByteARrayInputStream built from the bytes of a String.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!