print("##########################################################")
getUrl = comm.httpGetGetUrl()
print("GET URL:  " .. getUrl)

postUrl = comm.httpGetPostUrl()
print("POST URL: " ..  postUrl)

print("\n检查 GET URL 变更")
error = false
comm.httpSetGetUrl('a')
if (getUrl ~= comm.httpGetGetUrl()) then
	comm.httpSetGetUrl(getUrl)
	error = (getUrl ~= comm.httpGetGetUrl())
else
	error = true
end

if error == false then 
	print("Get URL 成功变更")
else
	print("Get URL 变更出错")
end


print("\nChecking POST URL change")
error = false
comm.httpSetPostUrl('a')
if (postUrl ~= comm.httpGetPostUrl()) then
	comm.httpSetPostUrl(postUrl)
	error = (postUrl ~= comm.httpGetPostUrl())
else
	error = true
end

if error == false then 
	print("Post URL 成功变更")
else
	print("Post URL 变更出错")
end

print("\n检查 GET 请求")
getResponse = comm.httpGet("http://tasvideos.org/BizHawk.html")
if string.find(getResponse, "Bizhawk") then
	print("GET 貌似能成功")
else
	print("Bizhawk 网站挂了或者 GET 不成功")
end

print("\n检查内存映射文件")

size = comm.mmfScreenshot()
if size > 0 then
	print("成功写入内存映射文件")
else
	print("写入内存映射文件失败")
end

mmf_filename = comm.mmfGetFilename()
print("MMF 文件名: " .. mmf_filename)
comm.mmfSetFilename("deleteme.tmp")
error = false
if (mmf_filename ~= comm.mmfGetFilename()) then
	comm.mmfSetFilename(mmf_filename)
	error = (mmf_filename ~= comm.mmfGetFilename())
else
	error = true
end
if error == false then 
	print("MMF 文件成功更名")
else
	print("MMF 文件更名失败")
end

print("写入 MMF")

message = "ABC"
resp_n = tonumber(comm.mmfWrite(mmf_filename, message))
if (resp_n ~= string.len(message)) then
	print("写入 MMF 失败")
else
	resp = comm.mmfRead(mmf_filename, string.len(message))
	if (resp ~= message) then
		print("读取 MMF 失败")
	else
		print("MMF 读取成功")
	end 
end


print("\n测试结束")
print("请以支持的 Python 服务器运行 TestCommunication_All.lua 做进一步测试")
