first test was hanging when webpage was trying to connect - had to add 1ms delay for the first test, it does not work if no delay is configured. Also some rename for threading.