private static Object lock = new Object();
private static BufferedReader inputReader;
public static void main(String[] args) {
Properties pp = parseArguments(args);
int contentSize = DEFAULT_CONTENT_SIZE;
try {
contentSize = Integer.parseInt(pp.getProperty(CONTENT_SIZE));
}
catch (Exception e) {
// Keep default
}
content = new byte[contentSize];
timeInterval = DEFAULT_TIME_INTERVAL;
try {
timeInterval = Long.parseLong(pp.getProperty(TIME_INTERVAL));
}
catch (Exception e) {
// Keep default
}
nIterations = DEFAULT_N_ITERATIONS;
try {
nIterations = Integer.parseInt(pp.getProperty(N_ITERATIONS));
}
catch (Exception e) {
// Keep default
}
base = DEFAULT_BASE;
try {
base = Integer.parseInt(pp.getProperty(BASE));
}
catch (Exception e) {
// Keep default
}
mode = READY_GO_MODE;
try {
String modeStr = pp.getProperty(MODE);
if (SLOW_MODE_S.equals(modeStr)) {
mode = SLOW_MODE;
}
else if (FAST_MODE_S.equals(modeStr)) {
mode = FAST_MODE;
}
else if (STEP_BY_STEP_MODE_S.equals(modeStr)) {
mode = STEP_BY_STEP_MODE;
}
}
catch (Exception e) {
// Keep default
}
// Prepare the inputReader to get user inputs if necessary
if (mode == READY_GO_MODE || mode == STEP_BY_STEP_MODE) {
inputReader = new BufferedReader(new InputStreamReader(System.in));
}
nCouples = DEFAULT_N_COUPLES;
try {
nCouples = Integer.parseInt(pp.getProperty(N_COUPLES));
}
catch (Exception e) {
// Keep default
}
measure = BITRATE_MEASURE;
try {
String measureStr = pp.getProperty(MEASURE);
if (RTT_MEASURE_S.equals(measureStr)) {
measure = RTT_MEASURE;
}
}
catch (Exception e) {
// Keep default
}
String prefix = Profile.getDefaultNetworkName();
for (int i = base; i < base+nCouples; i++) {
initCouple(pp.getProperty(MicroRuntime.HOST_KEY), pp.getProperty(MicroRuntime.PORT_KEY), pp.getProperty(MicroRuntime.CONN_MGR_CLASS_KEY), pp.getProperty(JICPProtocol.MEDIATOR_CLASS_KEY), pp.getProperty(JICPProtocol.MAX_DISCONNECTION_TIME_KEY), prefix, i);
switch (mode) {
case SLOW_MODE:
waitABit();
break;
case STEP_BY_STEP_MODE: