public String receiveMessage() {
    throw_exception();
    if(block_channel==1){
      return null;
    }
    if(reorder_msg==0){
      synchronized(test_network.test_queues[test_index]) {
        if(lose_msg==1){
          while(!test_network.test_queues[test_index].isEmpty())
            test_network.test_queues[test_index].remove();
        }
        else{    
          if (!test_network.test_queues[test_index].isEmpty()){
            String msg=test_network.test_queues[test_index].remove();
            update_MessageTrace(" Recv <- "+msg);
            return msg;
          }
          else
            return null;
        }
      }
    }

    if(reorder_msg==1){
      synchronized(test_network.test_stacks[test_index]) {
        if(lose_msg==1){
          while(!test_network.test_stacks[test_index].isEmpty())
            test_network.test_stacks[test_index].pop();
        }
        else{    
          if (!test_network.test_stacks[test_index].isEmpty()){
            String msg=test_network.test_stacks[test_index].pop();
            update_MessageTrace(" Recv <- "+msg);
            return msg;
          }
          else
            return null;
        }
      }
    }
    return null;
  }