diff --git a/includes/mollom.class.inc b/includes/mollom.class.inc
index e8a65e1..d192427 100644
--- a/includes/mollom.class.inc
+++ b/includes/mollom.class.inc
@@ -506,8 +506,14 @@ abstract class Mollom {
         $response->data = json_decode($response->body, TRUE);
       }
       elseif (strstr($response->headers['content-type'], 'application/xml')) {
-        $response->elements = new SimpleXmlIterator($response->body);
-        $response->data = $this->parseXML($response->elements);
+        try {
+          $response->elements = new SimpleXmlIterator($response->body);
+          $response->data = $this->parseXML($response->elements);
+        }
+        catch (Exception $e) {
+          // Invalid XML so just set the data back to blank.
+          $response->data = array();
+        }
       }
     }
 
diff --git a/mollom.admin.inc b/mollom.admin.inc
index a9b4f09..160e76c 100644
--- a/mollom.admin.inc
+++ b/mollom.admin.inc
@@ -866,7 +866,7 @@ function mollom_admin_settings($form, &$form_state) {
     )),
     '#collapsible' => TRUE,
     // Only show key configuration fields if they are not configured or invalid.
-    '#collapsed' => $status['isVerified'],
+    '#collapsed' => !$status['isVerified'],
   );
   // Keys are not #required to allow to install this module and configure it
   // later.
diff --git a/mollom.drupal.inc b/mollom.drupal.inc
index 6b9d17d..382f032 100644
--- a/mollom.drupal.inc
+++ b/mollom.drupal.inc
@@ -17,6 +17,11 @@ class MollomDrupal extends Mollom {
    */
   public function __construct() {
     parent::__construct();
+    // Set any configured endpoint that may be different from the default.
+    $configured_server = $this->loadConfiguration('server');
+    if (!empty($configured_server)) {
+      $this->server = $configured_server;
+    }
     $this->requestTimeout = variable_get('mollom_connection_timeout', 3);
   }
 
@@ -29,6 +34,7 @@ class MollomDrupal extends Mollom {
     'publicKey' => 'mollom_public_key',
     'privateKey' => 'mollom_private_key',
     'expectedLanguages' => 'mollom_languages_expected',
+    'server' => 'mollom_api_endpoint',
   );
 
   /**
@@ -43,6 +49,11 @@ class MollomDrupal extends Mollom {
    * Implements Mollom::saveConfiguration().
    */
   public function saveConfiguration($name, $value) {
+    // Set local variable.
+    if (property_exists('MollomDrupal', $name)) {
+      $this->{$name} = $value;
+    }
+    // Persist in Drupal.
     $name = $this->configuration_map[$name];
     return variable_set($name, $value);
   }
@@ -223,6 +234,7 @@ class MollomDrupalTest extends MollomDrupal {
       // Do not destroy production variables when testing mode is enabled.
       $this->configuration_map['publicKey'] = 'mollom_test_public_key';
       $this->configuration_map['privateKey'] = 'mollom_test_private_key';
+      $this->configuration_map['server'] = 'mollom_test_api_endpoint';
     }
 
     // Load and set publicKey and privateKey configuration values.
@@ -414,8 +426,10 @@ class MollomDrupalTestInvalid extends MollomDrupalTest {
    */
   function __construct() {
     $this->originalServer = $this->server;
-    $this->server = 'fake-host';
+    $this->configuration_map['server'] = 'mollom_test_invalid_api_endpoint';
     parent::__construct();
+
+    $this->saveConfiguration('server', 'fake-host');
   }
 
   /**
diff --git a/mollom.module b/mollom.module
index f344f43..abaae88 100644
--- a/mollom.module
+++ b/mollom.module
@@ -2510,8 +2510,10 @@ function mollom_form_submit($form, &$form_state) {
  * @param $class
  *   (optional) The name of a Mollom client implementation class to instantiate.
  *   Overrides the 'mollom_class' configuration variable. Debug use only.
+ * @param $force
+ *   (optional) If true, then a new class is always instantiated.
  */
-function mollom($class = NULL) {
+function mollom($class = NULL, $force = FALSE) {
   $instances = &drupal_static(__FUNCTION__, array());
   if (!isset($class)) {
     if (variable_get('mollom_testing_mode', 0)) {
@@ -2523,7 +2525,7 @@ function mollom($class = NULL) {
   }
   // If there is no instance yet or if it is not of the desired class, create a
   // new one.
-  if (!isset($instances[$class]) || !($instances[$class] instanceof $class)) {
+  if ($force || !isset($instances[$class]) || !($instances[$class] instanceof $class)) {
     $instances[$class] = new $class();
   }
   return $instances[$class];
diff --git a/tests/mollom.test b/tests/mollom.test
index c349a12..decb68e 100644
--- a/tests/mollom.test
+++ b/tests/mollom.test
@@ -328,12 +328,15 @@ class MollomWebTestCase extends DrupalWebTestCase {
 
   /**
    * Instantiate a Mollom client and make it available on $this->mollom;
+   *
+   * @param $force
+   *   (Optional) If true, then a new class is always instantiated.
    */
-  protected function getClient() {
-    if (!isset($this->mollom)) {
+  protected function getClient($force = FALSE) {
+    if ($force || !isset($this->mollom)) {
       // mollom.module may not be enabled in the parent site executing the test.
       drupal_load('module', 'mollom');
-      $this->mollom = mollom($this->mollomClass);
+      $this->mollom = mollom($this->mollomClass, $force);
     }
     return $this->mollom;
   }
@@ -1276,7 +1279,6 @@ class MollomInstallationTestCase extends MollomWebTestCase {
     $this->assertNoText($message_missing);
     $this->assertNoText($message_invalid);
 
-
     // Verify that deleting keys throws the correct error message again.
     $this->drupalGet('admin/config/content/mollom/settings');
     $this->assertText($message_valid);
@@ -1284,7 +1286,7 @@ class MollomInstallationTestCase extends MollomWebTestCase {
       'mollom_public_key' => '',
       'mollom_private_key' => '',
     );
-    $this->drupalPost(NULL, $edit, t('Save configuration'));
+    $this->drupalPost(NULL, $edit, t('Save configuration'), array('watchdog' => WATCHDOG_EMERGENCY));
     $this->assertText($message_saved);
     $this->assertNoText($message_valid);
     $this->assertText($message_missing);
@@ -1725,6 +1727,48 @@ class MollomResponseLocalTestCase extends MollomResponseTestCase {
   }
 }
 
+/**
+ * Tests low-level communication with configured server.
+ */
+class MollomResponseConfiguredTestCase extends MollomWebTestCase {
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Server responses (configured)',
+      'description' => 'Tests that a configured endpoint behaves the same as specified endpoints.',
+      'group' => 'Mollom',
+    );
+  }
+
+  function setUp() {
+    parent::setUp(array('mollom_test_server', 'mollom_test', 'mollom'));
+  }
+
+  function testConfiguredUrl() {
+    // Set the configured URL to be the same as the test server endpoing.
+    $test_url = $this->getAbsoluteURL('mollom-test/rest');
+    $stripped = preg_replace('/^[a-z]+:\\/\\//i', '', $test_url);
+    variable_set('mollom_api_endpoint', $stripped);
+
+    // Clear out Mollom local variable so that it can be instantiated with the
+    // correct endpoint.
+    $this->getClient(TRUE);
+
+    // The DrupalTest class should now use the local test server.
+    $this->setKeys();
+    $this->assertValidKeys();
+
+    // Check the watchdog from the key assertion is using the correct server.
+    // If the keys passed assertion, then they were created on the right server
+    // too.
+    foreach ($this->messages as $row) {
+      $output = theme_dblog_message(array('event' => $row, 'link' => FALSE));
+      $this->assertTrue(strpos($output, 'Request: POST ' . $test_url . '/v1/site/') !== FALSE, 'Keys verified from configured endpoint.');
+    }
+  }
+}
+
+
 class MollomAccessTestCase extends MollomWebTestCase {
   protected $mollomClass = 'MollomDrupalTestLocal';
   protected $createKeys = FALSE;
