 
 # Networking code
 
-EventEmitter = require('events').EventEmitter
-
-class Connection extends EventEmitter
+class Connection extends events.EventEmitter
     DEFAULT_HOST: 'localhost'
     DEFAULT_PORT: 28015
     DEFAULT_AUTH_KEY: ''

        @write finalArray.buffer

class TcpConnection extends Connection
    @isAvailable: -> testFor('net')

    constructor: (host, callback) ->
        unless TcpConnection.isAvailable()

        if @rawSocket?
            @close()

        @rawSocket = net.connect @port, @host
        @rawSocket.setNoDelay()

