Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnzhou committed Jan 6, 2025
1 parent 8f78702 commit a25f4ec
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Sources/NIOWebSocket/WebSocketProtocolErrorHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public final class WebSocketProtocolErrorHandler: ChannelInboundHandler {

/// Indicate that this `ChannelHandeler` is used by a WebSocket server or client. Default is true.
public var isServer: Bool

public init() {
self.isServer = true
}
Expand Down
8 changes: 4 additions & 4 deletions Tests/NIOWebSocketTests/WebSocketClientEndToEndTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -466,24 +466,24 @@ class WebSocketClientEndToEndTests: XCTestCase {
// Close the pipeline.
XCTAssertNoThrow(try clientChannel.close().wait())
}

func testErrorHandlerMaskFrameForClient() throws {

let (clientChannel, _) = try self.runSuccessfulUpgrade()
let maskBitMask: UInt8 = 0x80

var data = clientChannel.allocator.buffer(capacity: 4)
// A fake frame header that claims that the length of the frame is 16385 bytes,
// larger than the frame max.
data.writeBytes([0x81, 0xFE, 0x40, 0x01])

XCTAssertThrowsError(try clientChannel.writeInbound(data)) { error in
XCTAssertEqual(.invalidFrameLength, error as? NIOWebSocketError)
}

clientChannel.embeddedEventLoop.run()
var buffer = try clientChannel.readAllOutboundBuffers()

guard let (_, secondByte) = buffer.readMultipleIntegers(as: (UInt8, UInt8).self) else {
XCTFail("Insufficient bytes from WebSocket frame")
return
Expand Down
2 changes: 1 addition & 1 deletion Tests/NIOWebSocketTests/WebSocketFrameDecoderTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ public final class WebSocketFrameDecoderTest: XCTestCase {
// We need to insert a decoder that doesn't do error handling, and then a separate error
// handler.
self.swapDecoder(for: ByteToMessageHandler(WebSocketFrameDecoder()))

let errorHandler = WebSocketProtocolErrorHandler()
errorHandler.isServer = false
XCTAssertNoThrow(
Expand Down

0 comments on commit a25f4ec

Please sign in to comment.