diff --git a/app/src/androidTest/java/github/daneren2005/dsub/domain/JUPNPTest.java b/app/src/androidTest/java/github/daneren2005/dsub/domain/JUPNPTest.java new file mode 100644 index 000000000..f161fc91d --- /dev/null +++ b/app/src/androidTest/java/github/daneren2005/dsub/domain/JUPNPTest.java @@ -0,0 +1,50 @@ +package github.daneren2005.dsub.domain; + +import java.text.ParseException; + +import org.jupnp.model.action.ActionInvocation; +import org.jupnp.model.message.control.ActionResponseMessage; +import org.jupnp.model.meta.Action; +import org.jupnp.transport.impl.SOAPActionProcessorImpl; + +import junit.framework.TestCase; + +public class JUPNPTest extends TestCase { + public void testParseWithPooledParsers() throws ParseException { + // for context see: https://github.com/jupnp/jupnp/issues/232 + SOAPActionProcessorImpl p = new SOAPActionProcessorImpl(); + ActionResponseMessage arg1 = new ActionResponseMessage() { + final String body = "10doesn't really matterdoesn't really matter0:00:000:00:0021474836472147483647"; + + @Override + public String getActionNamespace() { + System.out.println("GetActionNamespace"); + return "GetActionNamespace"; + } + + @Override + public boolean isBodyNonEmptyString() { + System.out.println("IsBodyNonEmptyString"); + return true; + } + + @Override + public String getBodyString() { + System.out.println("getBodyString"); + return body; + } + + @Override + public void setBody(String string) { + System.out.println("setBody"); + } + }; + ActionInvocation arg2 = new ActionInvocation(new Action("GetPositionInfo", null)); + for (int i = 0; i < 20; i++) { // 20 is default pool size + p.readBody(arg1, arg2); + } + System.out.println("--- Crash after this line ---"); + p.readBody(arg1, arg2); + + } +} \ No newline at end of file