I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit d5607ca1 authored by jrandom's avatar jrandom Committed by zzz
Browse files

* updated output stream test to match new API

* new paired stream server and client helpers
parent 48cdf17a
No related branches found
No related tags found
No related merge requests found
......@@ -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();
......
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);
}
}
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();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment