    @Test
    public void testReceiveNumber() throws Exception {

        Pig pig = PigTestUtils.getMockedPiggie();

        PigTestUtils.addMockHandler(pig, new MockWebViewWrapper.Handler(pig) {
            public void handle(String data) {
                send("1");
            }
        });

        stringReceived = false;
        stringReceivedError = null;
        stringReceivedResponse = null;

        final CountDownLatch lock = new CountDownLatch(1);

        pig.execute("event", new Pig.Callback<Integer>() {
            @Override
            public void onSuccess(Integer response) {
                numberReceived = true;
                numberReceivedError = null;
                numberReceivedResponse = response;
                lock.countDown();
            }

            @Override
            public void onError(String code, String name, String message) {
                numberReceived = true;
                numberReceivedError = message;
                numberReceivedResponse = null;
                lock.countDown();
            }
        });

        lock.await(2000, TimeUnit.MILLISECONDS);

        assertTrue(numberReceived);
        assertTrue(numberReceivedError == null);
        assertTrue(numberReceivedResponse.equals(1));
    }