* updated output stream test to match new API
* new paired stream server and client helpers
This commit is contained in:
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user