title: MongoDB: No server chosen by ReadPreferenceServerSelector
body: <p>Recently I am using mongodb java async driver which is newly released. I am writing some simple test codes, which are:</p>
  
  <pre><code>    MongoClient mongoClient = MongoClients.create();
      System.out.println("database has been connected!");
  
      SingleResultCallback&lt;Void&gt; callbackWhenFinished = new SingleResultCallback&lt;Void&gt;() {
          @Override
          public void onResult(final Void result, final Throwable t) {
              System.out.println("Operation Finished!");
          }
      };
  
      mongoClient.listDatabaseNames().forEach(new Block&lt;String&gt;() {
          @Override
          public void apply(final String s) {
              System.out.println(s);
          }
      }, callbackWhenFinished);
  </code></pre>
  
  <p>however, the callback function is not called, the console output is:</p>
  
  <blockquote>
    <p>April 18, 2015 10:50:27 afternoon
    com.mongodb.diagnostics.logging.JULLogger log message: Cluster created
    with settings {hosts=[localhost:27017], mode=SINGLE,
    requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms',
    maxWaitQueueSize=500}<br>
    <strong>database has been connected!</strong>       April 18, 2015 10:50:28 afternoon com.mongodb.diagnostics.logging.JULLogger log message: <strong>No
    server chosen by
    ReadPreferenceServerSelector</strong>{readPreference=primary} from cluster
    description ClusterDescription{type=UNKNOWN, connectionMode=SINGLE,
    all=[ServerDescription{address=localhost:27017, type=UNKNOWN,
    state=CONNECTING}]}. Waiting for 30000 ms before timing out</p>
  </blockquote>
  
  <p>So you can see there is no callback function called. Anyone knows why?</p>