title: Simple python telnet client/server example doesn't work
body: <p>I'm trying to create mockup telnet server (for some functional testing of existing code). Right now I only modified server welcome message and I was trying to read this message using client code, but it read method fails on timeout with no additional info. But with pudb debugger enabled it works most of the time...</p>
  
  <p>I'm using virtualenv, with pudb and telnetsrv installed using pip. Python 2.7.12, ubuntu 16.04.</p>
  
  <p>Server code:</p>
  
  <pre><code>import SocketServer
  from telnetsrv.threaded import TelnetHandler
  
  class MyHandler(TelnetHandler):
  
      WELCOME = "HI from custom server"
  
  class TelnetServer(SocketServer.TCPServer):
      allow_reuse_address = True
  
  server = TelnetServer(("0.0.0.0", 8023), MyHandler)
  server.serve_forever()
  </code></pre>
  
  <p>Client code:</p>
  
  <pre><code>import telnetlib
  
  HOST = '127.0.0.1'
  PORT = 8023
  # from pudb import set_trace; set_trace()
  tn = telnetlib.Telnet(HOST, PORT)
  
  data = tn.read_until("custom server", timeout=1)
  print "Data: " + data
  
  tn.close()
  </code></pre>
  
  <p>Client output:</p>
  
  <pre><code>$ python client.py
  Data:
  </code></pre>
  
  <p>Client output with pudb enabled (with step-by-step execution)</p>
  
  <pre><code>$ python client.py
  Data: HI from custom server
  </code></pre>
  
  <p>Of course when I execute shell telnet command, it all works fine:</p>
  
  <pre><code>$ telnet 127.0.0.1 8023
  Trying 127.0.0.1...
  Connected to 127.0.0.1.
  Escape character is '^]'.
  HI from custom server
  Telnet Server&gt; 
  </code></pre>
  
  <p>I'd really appreciate any hints on how to debug this problem. Thanks!</p>