Several get(...) and post(...) methods of com.github.dockerjava.core.DefaultInvocationBuilder class (where com.github.dockerjava.api.async.ResultCallback argument is passed) call executeAndStream(...) method. This method starts the separate thread which actually performs HTTP request. This method does not wait until the thread is started. This leads to the race condition where several consequent requests could be mixed up in the timeline.
F.e. in com.github.dockerjava.cmd.AttachContainerCmdIT.attachContainerWithTTY() test there are two commands that is performed consequently: "attach to container" and "start container". Sometimes HTTP requests are performed in the reverse order (start and then attach). This results in the lost data from stdout and stderr streams of the container process and leads to the test failure.