docs: def run(self):
          """
          Continuously retrieve client requests until given "stop" request.
          """
          while True:
              self._logger.debug('Accepting connection')
              conn, addr = self._sock.accept()
              self._talk = SocketTalk(conn, encode=self._encode)
  
              self._logger.debug('Receiving action')
              action = self._receive()
  
              if self._on_action:
                  self._on_action(action)
  
              key = None
              if action in ('set', 'get', 'del',):
                  self._logger.debug('Receiving key')
                  key = self._receive()
  
              value = None
              if action in ('set',):
                  self._logger.debug('Receiving value')
                  value = self._receive()
  
              # Process the request.
              if action == 'stop':
                  self._send('ok')
  
              elif action == 'set':
                  self._data[key] = value
                  self._send('ok')
  
              elif action == 'get':
                  try:
                      value = self._data[key]
                  except:
                      self._logger.debug('Sending "key not found"')
                      self._send('key not found')
                  else:
                      self._logger.debug('Sending "ok"')
                      self._send('ok')
                      self._logger.debug('Sending value')
                      self._send(value)
  
              elif action == 'del':
                  try:
                      del self._data[key]
                  except:
                      self._logger.debug('Sending "key not found"')
                      self._send('key not found')
                  else:
                      self._logger.debug('Sending "ok"')
                      self._send('ok')
  
              elif action == 'size':
                  self._send('ok')
                  self._send(str(len(self._data)))
  
              elif action == 'keys':
                  pickled = pickle.dumps(self._data.keys())
                  self._send('ok')
                  self._send(pickled)
  
              else:
                  self._send('unknown action %s' % action)
  
              self._logger.debug('Closing')
              try:
                  conn.shutdown(socket.SHUT_RDWR)
              except:
                  self._logger.error('Failed to shutdown')
              conn.close()
  
              if action == 'stop':
                  break
  
          self._logger.debug('Stopped')