@Override
            public void extraCallback(String callbackName, Bundle args) {
                if (TestCustomTabsService.CALLBACK_BIND_TO_POST_MESSAGE.equals(callbackName)) {
                    // This gets run on the UI thread, where mServiceRule.bindService will not work.
                    AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> {
                        try {
                            Intent postMessageServiceIntent = new Intent();
                            postMessageServiceIntent.setClassName(mContext.getPackageName(),
                                    PostMessageService.class.getName());
                            mServiceRule.bindService(postMessageServiceIntent,
                                    mPostMessageServiceConnection, Context.BIND_AUTO_CREATE);
                        } catch (TimeoutException e) {
                            fail();
                        }
                    });
                }
            }
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