   drain: (fn) ->
     @_layer.drain fn
     return this
+
+  on: (eventId, handler) ->
+    @_server.on eventId, handler
+
+  emit: (eventId, data) ->
+    @_server.emit eventId, data
 
   ready: (callback) ->
     if @_server.listening

      return onFinish res

  .then ->
    # Prevent DoS attacks using large POST bodies.
    req.destroy() if req.reading
    measure req, res

  # Uncaught errors end up here.
  .fail (error) ->

onTimeout = (req, res) ->
  res.status 408
  res.send {error: "Request timed out"}
  @emit "response", req
  measure req, res

measure = (req, res) ->
