OK, after chasing my tail for a bit I think I see the issue.
I'm assuming you're following the tutorial here: Running the Tutorial
At the point where the tutorial asks you to execute the client (Part 5: Set Up Client/Server Caching), you should have set up a pair of cache servers using the gfsh command and not by running the Peer class. The initPeer method doesn't do enough for that all to work. Specifically you would need to have set up a CacheServer (sorry - I know the term 'server' is way overloaded here ). Anyway, the CacheServer is what needs to run and what the client connects to. If you start a server with gfsh, a CacheServer is automatically started.
If you wanted to augment the initPeer method, to start a CacheServer, you could add the following bit of code right after the Cache is created:
CacheServer cs = cache.addCacheServer(); cs.setPort(0); cs.start();
Here a CacheServer is started and will listen on a random port. You could set a port, but don't need to if your client uses a locator for discovery.
--Jens