def METHOD_NAME(self, line):
    if len(line) < 2 or line[-2:] != "\r\n":
        raise JSONRPC2ProtocolError("Line endings must be \\r\\n")
    if line.startswith("Content-Length: "):
        _, value = line.split("Content-Length: ")
        value = value.strip()
        try:
            return int(value)
        except ValueError:
            raise JSONRPC2ProtocolError(f"Invalid Content-Length header: {value}")