Skip to content

Commit

Permalink
Kitura/Kitura#33 removed server delegate
Browse files Browse the repository at this point in the history
  • Loading branch information
shmuelk committed Dec 8, 2016
1 parent b93bbda commit 75749c8
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions Tests/KituraWebSocketTests/UpgradeErrors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class UpgradeErrors: XCTestCase {
func testNoSecWebSocketKey() {
ConnectionUpgrader.register(factory: WSConnectionUpgradeFactory())

performServerTest(TestServerDelegate()) { expectation in
performServerTest() { expectation in
guard let socket = self.sendUpgradeRequest(forProtocolVersion: "13", toPath: "/testing123", usingKey: nil) else { return }

self.checkUpgradeResponse(from: socket, expectedMessage: "Sec-WebSocket-Key header missing in the upgrade request", expectation: expectation)
Expand All @@ -52,7 +52,7 @@ class UpgradeErrors: XCTestCase {
func testNoSecWebSocketVersion() {
ConnectionUpgrader.register(factory: WSConnectionUpgradeFactory())

performServerTest(TestServerDelegate(), asyncTasks: { expectation in
performServerTest(asyncTasks: { expectation in
guard let socket = self.sendUpgradeRequest(forProtocolVersion: nil, toPath: "/testing123", usingKey: nil) else { return }

self.checkUpgradeResponse(from: socket, expectedMessage: "Sec-WebSocket-Version header missing in the upgrade request", expectation: expectation)
Expand All @@ -67,7 +67,7 @@ class UpgradeErrors: XCTestCase {
func testNoService() {
ConnectionUpgrader.register(factory: WSConnectionUpgradeFactory())

performServerTest(TestServerDelegate()) { expectation in
performServerTest() { expectation in
guard let socket = self.sendUpgradeRequest(forProtocolVersion: "13", toPath: "/testing123", usingKey: "test") else { return }

self.checkUpgradeResponse(from: socket, expectedMessage: "No service has been registered for the path /testing123", expectation: expectation)
Expand All @@ -94,10 +94,4 @@ class UpgradeErrors: XCTestCase {
XCTFail("Failed to read the error message from the failed upgrade")
}
}

class TestServerDelegate : ServerDelegate {
func handle(request: ServerRequest, response: ServerResponse) {
XCTFail("Server delegate invoked in an Upgrade scenario")
}
}
}

0 comments on commit 75749c8

Please sign in to comment.