def onConnect(self, workerSocket, address):
        host, port = address
        try:
            if not self.protocolHandshake(workerSocket):
                logging.error("Control protocol version mismatch. Worker: %s", host)
                self.endSession(workerSocket, 'error:protocol_version_mismatch')
            elif not host in self.machinesInCluster:
                logging.error("Unexpected worker. Worker: %s", host)
                self.endSession(workerSocket, 'error:unknown_worker_address')
            elif not self.verifyTestId(workerSocket):
                logging.error("Unexpected testId. Worker: %s.", host)
                self.endSession(workerSocket, 'error:test_id_mismatch')
            else:
                self.addConnectedWorker((workerSocket, host))
        except socket.error:
            logging.error("Socket error from worker %s: %s", host, traceback.format_exc())
dataset/ETHPy150Open ufora/ufora/ufora/test/MultiMachineTestRunner.py/MultiMachineMasterRunner.onConnect/original