class_docstr: Class that represents one Telnet connection.
code: def __init__(self, conn, addr, application, server, encoding):
      assert isinstance(addr, tuple)  # (addr, port) tuple
      assert isinstance(application, TelnetApplication)
      assert isinstance(server, TelnetServer)
      assert isinstance(encoding, text_type)  # e.g. 'utf-8'
  
      self.conn = conn
      self.addr = addr
      self.application = application
      self.closed = False
      self.handling_command = True
      self.server = server
      self.encoding = encoding
      self.callback = None  # Function that handles the CLI result.
  
      # Create "Output" object.
      self.size = Size(rows=40, columns=79)
  
      # Initialize.
      _initialize_telnet(conn)
  
      # Create output.
      def get_size():
          return self.size
  
      self.stdout = _ConnectionStdout(conn, encoding=encoding)
      self.vt100_output = Vt100_Output(
          self.stdout, get_size, write_binary=False
      )
  
      # Create an eventloop (adaptor) for the CommandLineInterface.
      self.eventloop = _TelnetEventLoopInterface(server)
  
      # Set default CommandLineInterface.
      self.set_application(create_prompt_application())
  
      # Call client_connected
      application.client_connected(self)
  
      # Draw for the first time.
      self.handling_command = False
      self.cli._redraw()
  
imports: from __future__ import unicode_literals
  import socket
  import select
  import threading
  import os
  import fcntl
  from six import int2byte, text_type, binary_type
  from codecs import getincrementaldecoder
  from prompt_toolkit.enums import DEFAULT_BUFFER
  from prompt_toolkit.eventloop.base import EventLoop
  from prompt_toolkit.interface import CommandLineInterface, Application
  from prompt_toolkit.layout.screen import Size
  from prompt_toolkit.shortcuts import create_prompt_application
  from prompt_toolkit.terminal.vt100_input import InputStream
  from prompt_toolkit.terminal.vt100_output import Vt100_Output
  from .log import logger
  from .protocol import IAC, DO, LINEMODE, SB, MODE, SE, WILL, ECHO, NAWS, SUPPRESS_GO_AHEAD
  from .protocol import TelnetProtocolParser
  from .application import TelnetApplication
label_desc: Use image node_id 1 to create a new TelnetConnection object from inherited base classes: object with example: obj = TelnetConnection(conn, addr, application, server, encoding)