PHP HTTP tests fails with 'gnutls_handshake()' failed error

We’re running PHP 5.6.14, and receive intermittent errors when trying to run Selenium tests via Codecept:

[GuzzleHttp\Exception\ConnectException] cURL error 35: gnutls_handshake() failed: A TLS packet with unexpected length was received. (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

Re-running the build fixes this every time, but it would be great if we could get down to the bottom of what’s happening. Tests always work fine locally, and we haven’t changed anything.

This has gone from very sporadic to quite regular and it’s really starting to cause us some churn.