Exec start command: end of STDIN stream not detected

When docker exec is invoked from command line like this the end of input stream is properly detected and cat process finishes:

$ echo OK | docker exec -i some_busybox_container cat
OK
$

When I try to do the same with docker-java, the end of stream is not detected and cat process waits forever. This problem is not caught by com.github.dockerjava.netty.exec.ExecStartCmdExecTest#execStartAttachStdin test because .awaitCompletion(5, TimeUnit.SECONDS) doesn't fail if the process is not completed.