Made exception handling more consistent.
Added SimpleStateInfoProtocol and made the integ tests use it for locking on downloading gradle distributions.