'Receive line and make some action for some tokens: pause, rawpause,
stop, len, produce, unproduce.'

def lineReceived(self, line):

    self.received.append(line)
    if (line == ''):
        self.setRawMode()
    elif (line == 'pause'):
        self.pauseProducing()
        self.clock.callLater(0, self.resumeProducing)
    elif (line == 'rawpause'):
        self.pauseProducing()
        self.setRawMode()
        self.received.append('')
        self.clock.callLater(0, self.resumeProducing)
    elif (line == 'stop'):
        self.stopProducing()
    elif (line[:4] == 'len    '):
        self.length = int(line[4:])
    elif line.startswith('produce'):
        self.transport.registerProducer(self, False)
    elif line.startswith('unproduce'):
        self.transport.unregisterProducer()
