     sinon.stub fileListMock, 'refresh'
     sinon.stub executor, 'schedule'
 
+    RAW_MESSAGE = JSON.stringify {refresh: false}
+
     request = new HttpRequestMock '/__run__', {
       'content-type': 'application/json'
-      'content-length': 1
+      'content-length': RAW_MESSAGE.length
     }
-    request.setEncoding = -> null
 
     handler request, response, nextSpy
 
-    request.emit 'data', JSON.stringify {refresh: false}
+    request.emit 'data', RAW_MESSAGE
     request.emit 'end'
 
     process.nextTick ->

      expect(config.client.args).to.deep.equal ['arg1', 'arg2']
      done()

    request = new HttpRequestMock '/__run__', {
      'content-type': 'application/json'
      'content-length': 1
    }
    request.setEncoding = -> null

    handler request, response, nextSpy

    request.emit 'data', '{"args": ["arg1", "arg2"]}'
    request.emit 'end'



    sinon.stub fileListMock, 'changeFile'
    sinon.stub fileListMock, 'removeFile'

    RAW_MESSAGE = JSON.stringify
      addedFiles: ['/new.js']
      removedFiles: ['/foo.js', '/bar.js']
      changedFiles: ['/changed.js']

    request = new HttpRequestMock '/__run__', {
      'content-type': 'application/json'
      'content-length': RAW_MESSAGE.length
    }

    handler request, response, nextSpy

    request.emit 'data', RAW_MESSAGE
    request.emit 'end'

    process.nextTick ->
