diff --git a/apps/streaming/java/test/net/i2p/client/streaming/MessageOutputStreamTest.java b/apps/streaming/java/test/net/i2p/client/streaming/MessageOutputStreamTest.java index d3b48cd79..59386c1c9 100644 --- a/apps/streaming/java/test/net/i2p/client/streaming/MessageOutputStreamTest.java +++ b/apps/streaming/java/test/net/i2p/client/streaming/MessageOutputStreamTest.java @@ -53,11 +53,20 @@ public class MessageOutputStreamTest { public Receiver() { _data = new ByteArrayOutputStream(); } - public void writeData(byte[] buf, int off, int size) throws IOException { + public MessageOutputStream.WriteStatus writeData(byte[] buf, int off, int size) { _data.write(buf, off, size); + return new DummyWriteStatus(); } public byte[] getData() { return _data.toByteArray(); } } + + private static class DummyWriteStatus implements MessageOutputStream.WriteStatus { + public void waitForAccept(int maxWaitMs) { return; } + public void waitForCompletion(int maxWaitMs) { return; } + public boolean writeAccepted() { return true; } + public boolean writeFailed() { return false; } + public boolean writeSuccessful() { return true; } + } public static void main(String args[]) { MessageOutputStreamTest t = new MessageOutputStreamTest(); diff --git a/apps/streaming/java/test/net/i2p/client/streaming/StreamSinkTestClient.java b/apps/streaming/java/test/net/i2p/client/streaming/StreamSinkTestClient.java new file mode 100644 index 000000000..c44af7a25 --- /dev/null +++ b/apps/streaming/java/test/net/i2p/client/streaming/StreamSinkTestClient.java @@ -0,0 +1,35 @@ +package net.i2p.client.streaming; + +import net.i2p.client.I2PClient; + +/** + * + */ +public class StreamSinkTestClient { + public static void main(String args[]) { + System.setProperty(I2PSocketManagerFactory.PROP_MANAGER, I2PSocketManagerFull.class.getName()); + //System.setProperty(I2PClient.PROP_TCP_HOST, "dev.i2p.net"); + //System.setProperty(I2PClient.PROP_TCP_PORT, "4501"); + System.setProperty("tunnels.depthInbound", "0"); + + if (args.length <= 0) { + send("/home/jrandom/libjbigi.so"); + } else { + for (int i = 0; i < args.length; i++) + send(args[i]); + } + } + + private static void send(final String filename) { + Thread t = new Thread(new Runnable() { + public void run() { + StreamSinkSend.main(new String[] { filename, "0", "streamSinkTestLiveServer.key" }); + } + }, "client " + filename); + t.start(); + try { t.join(); } catch (Exception e) {} + System.err.println("Done sending"); + try { Thread.sleep(120*1000); } catch (Exception e) {} + //System.exit(0); + } +} diff --git a/apps/streaming/java/test/net/i2p/client/streaming/StreamSinkTestServer.java b/apps/streaming/java/test/net/i2p/client/streaming/StreamSinkTestServer.java new file mode 100644 index 000000000..ff2544e88 --- /dev/null +++ b/apps/streaming/java/test/net/i2p/client/streaming/StreamSinkTestServer.java @@ -0,0 +1,21 @@ +package net.i2p.client.streaming; + +import net.i2p.client.I2PClient; + +/** + * + */ +public class StreamSinkTestServer { + public static void main(String args[]) { + System.setProperty(I2PSocketManagerFactory.PROP_MANAGER, I2PSocketManagerFull.class.getName()); + //System.setProperty(I2PClient.PROP_TCP_HOST, "dev.i2p.net"); + //System.setProperty(I2PClient.PROP_TCP_PORT, "4101"); + System.setProperty("tunnels.depthInbound", "0"); + + new Thread(new Runnable() { + public void run() { + StreamSinkServer.main(new String[] { "streamSinkTestLiveDir", "streamSinkTestLiveServer.key" }); + } + }, "server").start(); + } +}