// set up connection to server
String host = args[0];
int port = Integer.parseInt(args[1]);
final Parser parser = new PipeParser();
LowerLayerProtocol llp = LowerLayerProtocol.makeLLP();
Connection connection = new Connection(parser, llp, new Socket(
host, port));
final Initiator initiator = connection.getInitiator();
connection.activate();
final String outText = "MSH|^~\\&|||||||ACK^^ACK|||R|2.4|\rMSA|AA";
// get a bunch of threads to send messages
for (int i = 0; i < 1000; i++) {
Thread sender = new Thread(new Runnable() {
public void run() {
try {
// get message ID
String ID = MessageIDGenerator.getInstance()
.getNewID();
Message out = parser.parse(outText);
Terser tOut = new Terser(out);
tOut.set("/MSH-10", ID);
// send, get response
Message in = initiator.sendAndReceive(out);