int main()
{
	orwell::support::GlobalLogger::Create("test_agent", "test_agent.log", true);
	log4cxx::NDC ndc("test_agent");
	ORWELL_LOG_INFO("Test starts\n");

	orwell::Application::CommandLineParameters aCommandLineArguments;
	aCommandLineArguments.m_agentPort = 9004;
	aCommandLineArguments.m_tickInterval = 1;
	aCommandLineArguments.m_gameDuration = 100;
	aCommandLineArguments.m_dryRun = false;
	aCommandLineArguments.m_broadcast = false;

	orwell::Application::Parameters aParameters;
	Arguments aArguments = Common::GetArguments(
			aCommandLineArguments,
			true);
	orwell::Application::ReadParameters(
			aArguments.m_argc,
			aArguments.m_argv,
			aParameters);
	TestAgent aTestAgent(aParameters.m_commandLineParameters.m_agentPort.get());
	std::thread aApplicationThread(Application, aParameters);
	aTestAgent.sendCommand("stop application");
	aApplicationThread.join();
	orwell::support::GlobalLogger::Clear();
	return 0;
}
static void Stopper()
{
	TestAgent aTestAgent(9003);
	ORWELL_LOG_INFO("create subscriber");
	zmq::context_t aContext(1);
	orwell::com::Receiver aSubscriber("tcp://127.0.0.1:9001", ZMQ_SUB, orwell::com::ConnectionMode::CONNECT, aContext);
	aTestAgent.sendCommand("ping", std::string("pong"));
	aTestAgent.sendCommand("add team TEAM");
	aTestAgent.sendCommand("add robot toto TEAM");
	aTestAgent.sendCommand("set robot toto video_url fake");
	aTestAgent.sendCommand("register robot toto");
	ExpectGameTime(Equals(2), aTestAgent);
	aTestAgent.sendCommand("start game");
	usleep(100 * 1000);
	bool aIsRunning = boost::lexical_cast< bool >(
			aTestAgent.sendCommand("get game running", boost::none));
	ORWELL_ASSERT_TRUE(aIsRunning, "Game should be running.");
	usleep(1000 * 1000);
	ExpectGameTime(MoreThan(0), aTestAgent);
	ExpectGameTime(LessThan(2), aTestAgent);
	usleep(1000 * 1000);
	aIsRunning = boost::lexical_cast< bool >(
			aTestAgent.sendCommand("get game running", boost::none));
	ORWELL_ASSERT_TRUE((!aIsRunning), "Game should not be running any more.");
	aTestAgent.sendCommand("stop application");
}