Skip to content

Commit

Permalink
RTN15c4 (#401)
Browse files Browse the repository at this point in the history
* RTN15c4

* RTN15c4: pending
  • Loading branch information
ricardopereira committed Apr 22, 2016
1 parent 7a1f8a5 commit c0b25d9
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Spec/RealtimeClientConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1546,6 +1546,37 @@ class RealtimeClientConnection: QuickSpec {
expect(client.msgSerial).to(equal(0))
}

// RTN15c4
pending("ERROR ProtocolMessage indicating a fatal error in the connection") {
let options = AblyTests.commonAppSetup()
options.disconnectedRetryTimeout = 1.0
let client = AblyTests.newRealtime(options)
defer { client.close() }
let channel = client.channels.get("test")

expect(client.connection.state).toEventually(equal(ARTRealtimeConnectionState.Connected), timeout: testTimeout)

client.onDisconnected()

let protocolError = AblyTests.newErrorProtocolMessage()
client.connection.once(.Connecting) { _ in
// Resuming
let transport = client.transport as! TestProxyTransport
transport.actionsIgnored += [.Connected]
client.onError(protocolError)
}

waitUntil(timeout: testTimeout) { done in
client.connection.once(.Failed) { stateChange in
expect(stateChange!.reason).to(beIdenticalTo(protocolError.error))
expect(client.connection.errorReason).to(beIdenticalTo(protocolError.error))
done()
}
}
expect(channel.state).to(equal(ARTRealtimeChannelState.Failed))
expect(channel.errorReason).to(beIdenticalTo(protocolError.error))
}

}

// RTN15d
Expand Down

0 comments on commit c0b25d9

Please sign in to comment.