def testServerNoOptions(self):
    raddress = '127.0.0.2'
    rport = 10000
    timeout = 5
    root = os.path.dirname(os.path.abspath(__file__))
    serverstate = tftpy.TftpContextServer(raddress, rport, timeout, root)
    self.assertTrue(isinstance(serverstate, tftpy.TftpContextServer))
    rrq = tftpy.TftpPacketRRQ()
    rrq.filename = '640KBFILE'
    rrq.mode = 'octet'
    rrq.options = {}
    serverstate.start(rrq.encode().buffer)
    for block in range(1, 1281):
        self.assertTrue(isinstance(serverstate.state, tftpy.TftpStateExpectACK))
        ack = tftpy.TftpPacketACK()
        ack.blocknumber = (block % 65536)
        serverstate.state = serverstate.state.handle(ack, raddress, rport)
    ack = tftpy.TftpPacketACK()
    ack.blocknumber = (1281 % 65536)
    finalstate = serverstate.state.handle(ack, raddress, rport)
    self.assertTrue((finalstate is None))
def testServerNoOptions(self):
    raddress = '127.0.0.2'
    rport = 10000
    timeout = 5
    root = os.path.dirname(os.path.abspath(__file__))
    serverstate = tftpy.TftpContextServer(raddress, rport, timeout, root)
    self.assertTrue(isinstance(serverstate, tftpy.TftpContextServer))
    rrq = tftpy.TftpPacketRRQ()
    rrq.filename = '640KBFILE'
    rrq.mode = 'octet'
    rrq.options = {}
    serverstate.start(rrq.encode().buffer)
    for block in range(1, 1281):
        self.assertTrue(isinstance(serverstate.state, tftpy.TftpStateExpectACK))
        ack = tftpy.TftpPacketACK()
        ack.blocknumber = (block % 65536)
        serverstate.state = serverstate.state.handle(ack, raddress, rport)
    ack = tftpy.TftpPacketACK()
    ack.blocknumber = (1281 % 65536)
    finalstate = serverstate.state.handle(ack, raddress, rport)
    self.assertTrue((finalstate is None))