awaitility/src/main/java/org/awaitility/core/ConditionFactory.java
public ConditionFactory pollInSameThread() {
        return new ConditionFactory(alias, timeoutConstraint, pollInterval, pollDelay, false,
                exceptionsIgnorer, conditionEvaluationListener, ExecutorLifecycle.withNormalCleanupBehavior(new Supplier<ExecutorService>() {
            @Override
            public ExecutorService get() {
                return InternalExecutorServiceFactory.sameThreadExecutorService();
            }
        }));
    }
public ConditionFactory pollInSameThread() {
        return new ConditionFactory(alias, timeoutConstraint, pollInterval, pollDelay, false,
                exceptionsIgnorer, conditionEvaluationListener, ExecutorLifecycle.withNormalCleanupBehavior(new Supplier<ExecutorService>() {
            @Override
            public ExecutorService get() {
                return InternalExecutorServiceFactory.sameThreadExecutorService();
            }
        }));
    }
Instructs Awaitility to execute the polling of the condition from the same as the test.
This is an advanced feature and you should be careful when combining this with conditions that
wait forever (or a long time) since Awaitility cannot interrupt the thread when it's using the same
thread as the test. For safety you should always combine tests using this feature with a test framework specific timeout,
for example in JUnit:
<pre>
@Test(timeout = 2000L)
public void myTest() {
Awaitility.pollInSameThread();
await().forever().until(...);
}
</pre>
@return the condition factory