@Test
    public void testCustomTabsConnection() {
        PollingCheck.waitFor(() -> mCustomTabsServiceConnected);
        assertTrue(mCustomTabsServiceConnected);
        assertTrue(mSession.requestPostMessageChannel(Uri.EMPTY));
        assertEquals(CustomTabsService.RESULT_SUCCESS, mSession.postMessage("", null));
        PollingCheck.waitFor(() -> mPostMessageServiceConnected);
        assertTrue(mPostMessageServiceConnected);
    }
Tests for a complete loop between a browser side {@link CustomTabsService}
and a client side {@link PostMessageService}. Both services are bound to through
{@link ServiceTestRule}, but {@link CustomTabsCallback#extraCallback} is used to link browser
side actions.
customtabs/tests/src/android/support/customtabs/PostMessageTest.java