Replace for TestKit GradleRunner

Is there a way to replace the standard input of a build started with GradleRunner?

The use case is to test a task similar to “runPlayBinary”, where Ctrl-D is used to stop the task. When running the custom task with GradleRunner, the spawned thread immediately fails because returns -1. Would there be a way to mock the behaviour, or at least to add a delay before is closed?