diff --git a/tests/solr_index_and_search.test b/tests/solr_index_and_search.test
index cbcd10b..3f27073 100755
--- a/tests/solr_index_and_search.test
+++ b/tests/solr_index_and_search.test
@@ -31,15 +31,16 @@ abstract class AbstractDrupalSolrOnlineWebTestCase extends DrupalWebTestCase {
     // Load the default server.
     $env_id = apachesolr_default_environment();
     $environment = apachesolr_environment_load($env_id);
+    // Because we are in a clean environment, this will
+    // always be the default - http://localhost:8983/solr
+    $this->core_admin_url = "{$environment['url']}/admin/cores";
 
-    if (apachesolr_server_status($environment['url'])) {
+    // The core admin url will give a valid response if the 
+    // Solr server is running locally.
+    if ($this->coreAdminAvailable()) {
       // We will use a core named after the simpletest prefix.
       // Normal base URL will be http://localhost:8983/solr
-      $base_url = $environment['url'];
       $environment['url'] .= '/' . $this->databasePrefix;
-      apachesolr_environment_save($environment);
-      $solr_url = $environment['url'];
-      $core_admin_url = "$base_url/admin/cores";
       $filesdir = variable_get('file_public_path');
 
       // Create our 'solr core dir'
@@ -60,19 +61,18 @@ abstract class AbstractDrupalSolrOnlineWebTestCase extends DrupalWebTestCase {
 
       // Change the autoCommit time down to 1 second.
       file_put_contents("$instancedir/conf/solrconfig.xml", preg_replace('@<maxTime>[0-9]+</maxTime>@', '<maxTime>1000</maxTime>', $contents));
-      $query['action'] = 'CREATE';
+
       $query['name'] = $this->databasePrefix;
       $query['instanceDir'] = $instancedir;
-      $this->drupalGet($core_admin_url, array('query' => $query));
-      $this->assertResponse(200);
-      $this->instancedir = $instancedir;
-      $this->solr_url = $solr_url;
-      $this->core_admin_url = $core_admin_url;
+      $created = $this->coreAdmin('CREATE', $query);
 
-      if (apachesolr_server_status($environment['url'])) {
+      if ($created && apachesolr_server_status($environment['url'])) {
+        $this->instancedir = $instancedir;
+        $this->solr_url = $environment['url'];
+        apachesolr_environment_save($environment);
         $this->solr = apachesolr_get_solr($env_id);
         $this->solr_available = TRUE;
-        $this->checkCoreStatus();
+        $this->checkCoreStatus($this->databasePrefix);
       }
       else {
         // workaround for drupal.org test bot
@@ -86,35 +86,43 @@ abstract class AbstractDrupalSolrOnlineWebTestCase extends DrupalWebTestCase {
     }
   }
 
+  protected function coreAdminAvailable() {
+    $url = url($this->core_admin_url, array('query' => array('action' => 'STATUS')));
+    $options['timeout'] = 2;
+    $result = drupal_http_request($url, $options);
+    return ($result->code == 200 && empty($result->error));
+  }
+
   /**
    * Helper function to invoke core admin actions.
    */
-  protected function coreAdmin($action, $return_response = FALSE) {
-    if ($this->solr_available) { // workaround for drupal.org test bot
-      $query = array();
-      $query['action'] = $action;
-      $query['wt'] = 'json';
-      $query['indent'] = '1';
-      $query['core'] = $this->databasePrefix;
-      $this->drupalGet($this->core_admin_url, array('query' => $query));
-      $this->assertResponse(200);
-      if ($return_response) {
-        return json_decode($this->drupalGetContent(), TRUE);
-      }
+  protected function coreAdmin($action, $query = array()) {
+    $query['action'] = $action;
+    $query['wt'] = 'json';
+    $query['indent'] = '1';
+    $this->drupalGet($this->core_admin_url, array('query' => $query));
+    if ($this->assertResponse(200)) {
+      return json_decode($this->drupalGetContent(), TRUE);
+    }
+    else {
+      return FALSE;
     }
   }
 
   /**
    * Helper function to verify that the expected core exists.
    */
-  protected function checkCoreStatus() {
-    $response = $this->coreAdmin('STATUS', TRUE);
-    $this->assertTrue(isset($response['status'][$this->databasePrefix]['index']), 'Found Solr test core index status');
+  protected function checkCoreStatus($core_name) {
+    $response = $this->coreAdmin('STATUS', array('core' => $core_name));
+    $this->assertTrue(isset($response['status'][$core_name]['index']), 'Found Solr test core index status');
   }
 
   function tearDown() {
-    // Unload the Solr core.
-    $this->coreAdmin('UNLOAD');
+    // Workaround for drupal.org test bot
+    if ($this->solr_available) {
+      // Unload the Solr core.
+      $this->coreAdmin('UNLOAD', array('core' => $this->databasePrefix));
+    }
     parent::tearDown();
   }
 }
