The solution to that problem is a communication system. A de energized connector makes contact. Some system checks the connection and ensure that it is safe. Only then is the connection energized. Same safety system monitors the connection for any malfunctions.