public CustomTabsSession establishSessionBlocking(Context context) {
        mContext = context;
        if (!CustomTabsClient.bindCustomTabsService(context, context.getPackageName(),
                mConnection)) {
            fail("Failed to bind the service");
            return null;
        }
        boolean success = false;
        try {
            success = mConnectionLatch.await(2, TimeUnit.SECONDS);
        } catch (InterruptedException e) {}
        if (!success) {
            fail("Failed to connect to service");
            return null;
        }
        return mSession;
    }
Binds the CustomTabsService, creates a {@link CustomTabsSession} and returns it.
customtabs/tests/src/android/support/customtabs/testutil/CustomTabConnectionRule.java