 
     func listen() throws
 
-    func receiveByte() throws -> Byte
+    func receiveByte() throws -> Byte?
     func receiveLine() throws -> String
 
     func sendHeaderEndOfLine() throws

}

extension HTTPStream {
    func receiveByte() throws -> Byte {
        repeat {
            if let byte = try receive(max: 1).first {
                return byte
            }
        } while true
    }

    func receiveLine() throws -> String {
        var line: String = ""

        func append(byte: Byte?) {
            guard let byte = byte else {
                return
            }
            guard byte >= minimumValidAsciiCharacter else {
                return
            }

            line.append(Character(byte))
        }

        while !closed, let byte = try receiveByte() where byte != newLine {
            append(byte)
        }

