diff --git a/java/javapayload/src/test/java/javapayload/stage/ShellTest.java b/java/javapayload/src/test/java/javapayload/stage/ShellTest.java index 4b9c81c7..940a215f 100644 --- a/java/javapayload/src/test/java/javapayload/stage/ShellTest.java +++ b/java/javapayload/src/test/java/javapayload/stage/ShellTest.java @@ -15,6 +15,11 @@ public class ShellTest extends TestCase { DataInputStream in = new DataInputStream(new ByteArrayInputStream(commands.getBytes("ISO-8859-1"))); ByteArrayOutputStream out = new ByteArrayOutputStream(); shell.start(in, out, new String[] {"Payload", "--", "Shell"}); + int timeout = 5000; + while (out.size() == 0 && timeout > 0) { + Thread.sleep(100); + timeout -= 100; + } String shellOutput = new String(out.toByteArray(), "ISO-8859-1"); Assert.assertTrue("MagicToken missing in shell output: "+shellOutput, shellOutput.contains("MagicToken")); Assert.assertEquals(-1, in.read());