### Question:
SessionClientImpl implements SessionClient { public void introspectToken(String token, String tokenType, final RequestCallback<IntrospectInfo, AuthorizationException> cb) { cancelFuture(); mFutureTask = mDispatcher.submit(() -> { Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); try { IntrospectInfo introspectInfo = mSyncSessionClient .introspectToken(token, tokenType); mDispatcher.submitResults(() -> cb.onSuccess(introspectInfo)); } catch (AuthorizationException ae) { mDispatcher.submitResults(() -> cb.onError(ae.error, ae)); } catch (Exception ex) { mDispatcher.submitResults(() -> cb.onError(ex.getMessage(), new AuthorizationException(ex.getMessage(), ex))); } }); } SessionClientImpl(Executor callbackExecutor, SyncSessionClient syncSessionClient); void getUserProfile(final RequestCallback<UserInfo, AuthorizationException> cb); void introspectToken(String token, String tokenType,
                                final RequestCallback<IntrospectInfo, AuthorizationException> cb); void revokeToken(String token,
                            final RequestCallback<Boolean, AuthorizationException> cb); void refreshToken(final RequestCallback<Tokens, AuthorizationException> cb); @Override Tokens getTokens(); @Override void authorizedRequest(@NonNull Uri uri, @Nullable Map<String, String> properties,
                                  @Nullable Map<String, String> postParameters,
                                  @NonNull ConnectionParameters.RequestMethod method,
                                  final RequestCallback<JSONObject, AuthorizationException> cb); boolean isAuthenticated(); void clear(); @Override void cancel(); @Override void migrateTo(EncryptionManager manager);  }### Answer:
@Test public void introspectToken() throws InterruptedException { mEndPoint.enqueueIntrospectSuccess(); final CountDownLatch latch = new CountDownLatch(1); MockRequestCallback<IntrospectInfo, AuthorizationException> cb = new MockRequestCallback<>(latch); mSessionClient.introspectToken(ACCESS_TOKEN, TokenTypeHint.ACCESS_TOKEN, cb); latch.await(); assertNotNull(cb.getResult()); assertTrue(cb.getResult().isActive()); }
@Test public void introspectTokenFailure() throws InterruptedException { mEndPoint.enqueueReturnInvalidClient(); final CountDownLatch latch = new CountDownLatch(1); MockRequestCallback<IntrospectInfo, AuthorizationException> cb = new MockRequestCallback<>(latch); mSessionClient.introspectToken(ACCESS_TOKEN, TokenTypeHint.ACCESS_TOKEN, cb); latch.await(); assertNull(cb.getResult()); assertNotNull(cb.getException()); }