 
     private func extractMaskingKey() throws -> MaskingKey {
         guard
-            let zero = try next(),
-            let one = try next(),
-            let two = try next(),
-            let three = try next()
+            let zero = try buffer.next(),
+            let one = try buffer.next(),
+            let two = try buffer.next(),
+            let three = try buffer.next()
             else {
                 throw "536: WebSockets.Swift: MessageParser"
         }



public final class StreamMessageParser {
//    private var iterator: AnyIterator<Byte>
    private let stream: Stream
    private init(_ stream: Stream) {
        self.stream = stream
//        print("next: \(next)")
//        var sequenceIterator = data.makeIterator()
//        iterator = AnyIterator { sequenceIterator.next() }
    }

    // TODO: Parsing single bytes here
    // Use chunking the way we did on other
    // part
    //
    // This section is not call / response, so chunking needs to be more accurate
    private func next() throws -> Byte? {
        return try stream.receive(upTo: 1).bytes.first
    }

    // MARK: Extractors

    private func extractByteZero() throws -> (fin: Bool, rsv1: Bool, rsv2: Bool, rsv3: Bool, opCode: OpCode) {
        guard let byteZero = try next() else {
            throw "479: WebSockets.Swift: MessageParser"
        }
        let fin = byteZero.containsMask(.fin)

        var count: UInt64 = 0
        var bytes: [UInt8] = []

        while count < length, let next = try buffer.next() {
            bytes.append(next)
            count += 1
        }
        
        return key.cypher(bytes)
    }
}

