Testing simple threads in java