Htmlunit fails to set a cookie. I checked the source and found the expiration data was parsed wrongly.
The cookie expiration string is "Sun Jan 20 2019 17:45:00 GMT+0800 (CST)". Htmlunit parses it to 0001-4-13 11:17:45 then regards it as expired. Real browser(Firefox) handles it correctly.
I added one additional format "EEE MMM dd yyyy HH mm ss 'GMT'Z" in the begining of all the 3 date patterns in com.gargoylesoftware.htmlunit.httpclient.HtmlUnitExpiresHandler, which seems fixed the problem.
Fixed in SVN; tahnaksfor reporting.
As soon as the (new) build server is ready you can download a new build at
http://83.169.43.181/jenkins/job/HtmlUnit%20-%20Fast%20Build/
Will inform on https://twitter.com/HtmlUnit if a new SNAPSHOT build is available for maven.