twisted.conch.telnet.AlreadyNegotiating

Here are the examples of the python api twisted.conch.telnet.AlreadyNegotiating taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

0 Source : test_telnet.py
with MIT License
from autofelix

    def testNegotiationBlocksFurtherNegotiation(self):
        # Try to disable an option, then immediately try to enable it, then
        # immediately try to disable it.  Ensure that the 2nd and 3rd calls
        # fail quickly with the right exception.
        s = self.p.getOptionState(b'\x24')
        s.him.state = 'yes'
        self.p.dont(b'\x24') # fires after the first line of _final

        def _do(x):
            d = self.p.do(b'\x24')
            return self.assertFailure(d, telnet.AlreadyNegotiating)


        def _dont(x):
            d = self.p.dont(b'\x24')
            return self.assertFailure(d, telnet.AlreadyNegotiating)


        def _final(x):
            self.p.dataReceived(telnet.IAC + telnet.WONT + b'\x24')
            # an assertion that only passes if d2 has fired
            self._enabledHelper(self.p.protocol, dR=[b'\x24'])
            # Make sure we allow this
            self.p.protocol.remoteEnableable = (b'\x24',)
            d = self.p.do(b'\x24')
            self.p.dataReceived(telnet.IAC + telnet.WILL + b'\x24')
            d.addCallback(self.assertEqual, True)
            d.addCallback(lambda _: self._enabledHelper(self.p.protocol,
                                                        eR=[b'\x24'],
                                                        dR=[b'\x24']))
            return d

        d = _do(None)
        d.addCallback(_dont)
        d.addCallback(_final)
        return d


    def testSuperfluousDisableRequestRaises(self):