title: Java Connect gemfire
body: <p>I create a test gemfire server.</p>
  
  <blockquote>
    <p>gfsh>start locator --name=test --bind-address=localhost --port=40404</p>
  </blockquote>
  
  <p>my java code is:</p>
  
  <pre><code>    ClientCacheFactory cf =  new ClientCacheFactory().addPoolServer( "localhost", 40404);
      ClientCache cache = cf.setPdxReadSerialized( true).create();
      ClientRegionFactory rf = cache.createClientRegionFactory(ClientRegionShortcut.PROXY);
  
      Region region = rf.create( "People");
  </code></pre>
  
  <p>but i try run,it not connect gemfire locator.i dont know way?</p>
  
  <pre><code> [warn 2017/07/02 06:53:51.363 HKT &lt;poolTimer-DEFAULT-2&gt; tid=0x17] Could not connect to: localhost:40404
  java.io.EOFException
  at java.io.DataInputStream.readByte(DataInputStream.java:267)
  at com.gemstone.gemfire.internal.cache.tier.sockets.HandShake.greet(HandShake.java:1291)
  at com.gemstone.gemfire.cache.client.internal.ConnectionImpl.connect(ConnectionImpl.java:111)
  at com.gemstone.gemfire.cache.client.internal.ConnectionFactoryImpl.createClientToServerConnection(ConnectionFactoryImpl.java:134)
  at com.gemstone.gemfire.cache.client.internal.ConnectionFactoryImpl.createClientToServerConnection(ConnectionFactoryImpl.java:252)
  at com.gemstone.gemfire.cache.client.internal.pooling.ConnectionManagerImpl.prefillConnection(ConnectionManagerImpl.java:794)
  at com.gemstone.gemfire.cache.client.internal.pooling.ConnectionManagerImpl.prefill(ConnectionManagerImpl.java:737)
  at com.gemstone.gemfire.cache.client.internal.pooling.ConnectionManagerImpl$PrefillConnectionsTask.run2(ConnectionManagerImpl.java:888)
  at com.gemstone.gemfire.cache.client.internal.PoolImpl$PoolTask.run(PoolImpl.java:1260)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:748)
  </code></pre>
  
  <p>[info 2017/07/02 06:53:51.421 HKT  tid=0xc] VM is exiting - shutting down distributed system</p>
  
  <p>[info 2017/07/02 06:53:51.422 HKT  tid=0xc] GemFireCache[id = 915500720; isClosing = true; isShutDownAll = false; closingGatewayHubsByShutdownAll = false; created = Sun Jul 02 06:53:51 HKT 2017; server = false; copyOnRead = false; lockLease = 120; lockTimeout = 60]: Now closing.</p>
  
  <p>[info 2017/07/02 06:53:51.436 HKT  tid=0xc] Resetting original MemoryPoolMXBean heap threshold bytes 0 on pool PS Old Gen</p>
  
  <p>[info 2017/07/02 06:53:51.467 HKT  tid=0xc] Destroying connection pool DEFAULT</p>