Fixed cf-runagent segfault. Added relevant tests.
Merge pull request #1555 from jimis/agent_protocol_version

Fixed cf-runagent segfault. Added relevant tests.