A routine for checking network services
A connection can fail at several different stages. Separating those stages makes a maintenance check repeatable and its result easier to understand.
Start with reachability
Record where the request starts and which service is being tested. A working connection from one network says little about a different network path.
Check identity separately
After the connection opens, verify the certificate chain, the requested hostname and the current time. Keep these checks enabled during routine maintenance.
Use a small transfer
A successful handshake establishes a connection but does not measure useful data transfer. Fetch a small known resource and check both the response and the received length.
Repeat after maintenance
After a service reload or system restart, open a fresh connection. An existing session may survive a change that prevents new sessions from starting.