   func testInvalidEndpoint() {
     let expectation = self.expectationWithDescription("fetch config")
 
-    let client = MockClient(deviceKey: "some-key", endpointScheme: "", endpointUrl: "garbage", endpointPort: nil)
+    let client = MockClient(deviceKey: "some-key", endpointScheme: "^^^", endpointUrl: "???", endpointPort: nil)
     client.connect() { error in
       XCTAssertNotNil(error)
       expectation.fulfill()

  }

  func testPublishFailure() {
    let expectation = self.expectationWithDescription("publish success")

    let client = MockClient(deviceKey: "some-key", expectedState: .DISCONNECTED)
    successMock()
    client.connect() { _ in
      do {
        XCTAssertThrowsError(try client.publishOn("data", message: "Hello"))
      } catch {}
      if let mqtt = client.mqttClient as? MockMQTTClient {
        XCTAssertFalse(mqtt.didPublish)
      }
      expectation.fulfill()
    }
    self.waitForExpectationsWithTimeout(0.5, handler: nil)
  }

}


  var expectedState = CocoaMQTTConnState.CONNECTED
  internal var didPublish = false
  internal var isSubscribed = false

  init(expectedState state: CocoaMQTTConnState) {
    expectedState = state
