def twisted_app(port):
from twisted.web import server<EOL>from twisted.web.resource import Resource<EOL>from twisted.web.static import File<EOL>from web.apps.twisted_app import TwistedApplication<EOL>class Main(Resource):<EOL><INDENT>def getChild(self, name, request):<EOL><INDENT>name = name.decode()<EOL>if name == '<STR_LIT>':<EOL><INDENT>return self<EOL><DEDENT>return self.children[name]<EOL><DEDENT>def render_GET(self, request):<EOL><INDENT>return HELLO_WORLD.encode()<EOL><DEDENT><DEDENT>class Landing(Resource):<EOL><INDENT>isLeaf = True<EOL>def render_GET(self, request):<EOL><INDENT>return LANDING_PAGE.encode()<EOL><DEDENT><DEDENT>root = Main()<EOL>root.putChild('<STR_LIT>', Landing())<EOL>root.putChild('<STR_LIT>', File(STATIC_PATH))<EOL>site = server.Site(root)<EOL>app = TwistedApplication(port=port, site=site)<EOL>app.timed_call(<NUM_LIT>, app.stop)<EOL>app.start()<EOL>
With logging

    Running 30s test @ http://127.0.0.1:8888/
      12 threads and 400 connections
      Thread Stats   Avg      Stdev     Max   +/- Stdev
        Latency   124.17ms   24.74ms 492.40ms   85.64%
        Req/Sec   245.94     80.01     0.86k    66.42%
      87585 requests in 30.05s, 11.78MB read
    Requests/sec:   2914.22
    Transfer/sec:    401.27KB