   client = juno.connection.client
   clientStatus = -> [client.isConnected(), client.isActive(), client.isWorking()]
   {echo, evalsimple} = client.import ['echo', 'evalsimple']
+  client.onConnected (connectSpy = jasmine.createSpy 'connect')
+  client.onDisconnected (disconnectSpy = jasmine.createSpy 'disconnect')
 
   describe "before booting", ->
 

        runs ->
          expect(client.isWorking()).toBe(false)

    it "can handle a large number of callbacks", ->
      n = 1000
      cbs = (evalsimple("sleep(rand()); #{i}^2") for i in [0...n])
      for i in [0...n]
        do (i) ->
          waitsForPromise ->
            cbs[i].then (result) -> expect(result).toBe(Math.pow(i, 2))

  describe "when the process is shut down", ->


    it "recognises the client's state after boot", ->
      expect(clientStatus()).toEqual [true, true, false]

    it "emits a connection event", ->
      expect(connectSpy.calls.length).toBe(1)

  describe "while the client is active", ->

    it "can send and receive nested objects, strings and arrays", ->
