 
 require('http').globalAgent.maxSockets = 65535
 
-class ClientProcess
+class ClientProcess extends EventEmitter
     constructor: (options) ->
-        {@appInstanceCount, @browserCount, @clientCount, @processId} = options
+        {@appInstanceCount, @browserCount, @clientCount,
+         @processId, @optimizeConnection, @batchSize} = options
         if @browserCount > @clientCount or @appInstanceCount > @browserCount or @appInstanceCount > @clientCount or @appInstanceCount <= 0
             msg = "invalid parameter appInstanceCount #{@appInstanceCount} browserCount #{browserCount} clientCount #{clientCount}"
             console.log(msg)

    resultLogger = debug("cloudbrowser:benchmark:result")
    opts.eventDescriptors = eventDescriptors
    clientProcess = new ClientProcess(opts)
    intervalObj = setInterval(()->
        resultLogger("Elapsed #{(new Date()).getTime() - clientProcess.stats.startTime}ms")
        clientProcess.timeOutCheck()
        resultLogger JSON.stringify(clientProcess.stats)
        sysMon.logStats()
        if clientProcess.isStopped()
            resultLogger "stopped"
            clearInterval(intervalObj)
            process.exit(1)
    , 3000
    )
)
                    logger("#{@id} emit browserConfig  #{@browserConfig.url}")
                    # creating socket after children clients send initial requests
                    @emit('browserconfig', @browserConfig)
                )

            timers.setImmediate(()=>
                @_createSocket()
                @_initialSocketIo()
            )
            logger("#{@id} opened #{@browserConfig.url}")
                
            @stats.add('initialPage', timeElapsed)
