소스 검색

add each party's code to test sscot

Boyoung- 8 년 전
부모
커밋
25255c7f40
7개의 변경된 파일162개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 1
      src/oram/Forest.java
  2. 1 1
      src/protocols/OutSSCOT.java
  3. 9 0
      src/ui/CLI.java
  4. 1 1
      test/misc/HelloWorld.java
  5. 50 0
      test/protocols/TestSSCOT_C.java
  6. 50 0
      test/protocols/TestSSCOT_D.java
  7. 50 0
      test/protocols/TestSSCOT_E.java

+ 1 - 1
src/oram/Forest.java

@@ -50,7 +50,7 @@ public class Forest implements Serializable {
 		init(md);
 		initTrees(md, rand);
 	}
-	
+
 	public Forest(Metadata md, Random rand) {
 		init(md);
 		initTrees(md, rand);

+ 1 - 1
src/protocols/OutSSCOT.java

@@ -3,7 +3,7 @@ package protocols;
 public class OutSSCOT {
 	public int t;
 	public byte[] m_t;
-	
+
 	public OutSSCOT(int t, byte[] m_t) {
 		this.t = t;
 		this.m_t = m_t;

+ 9 - 0
src/ui/CLI.java

@@ -97,6 +97,9 @@ public class CLI {
 				;
 			System.out.println("Connection established.");
 
+			debbieCon.setTcpNoDelay(true);
+			charlieCon.setTcpNoDelay(true);
+
 			debbieCon.write("start");
 			charlieCon.write("start");
 			debbieCon.readString();
@@ -137,6 +140,9 @@ public class CLI {
 				;
 			System.out.println("Connection established");
 
+			eddieCon.setTcpNoDelay(true);
+			charlieCon.setTcpNoDelay(true);
+
 			eddieCon.write("start");
 			charlieCon.write("start");
 			eddieCon.readString();
@@ -177,6 +183,9 @@ public class CLI {
 				;
 			System.out.println("Connection established");
 
+			eddieCon.setTcpNoDelay(true);
+			debbieCon.setTcpNoDelay(true);
+
 			eddieCon.write("start");
 			debbieCon.write("start");
 			eddieCon.readString();

+ 1 - 1
test/misc/HelloWorld.java

@@ -24,7 +24,7 @@ public class HelloWorld {
 		// throw new ArrayIndexOutOfBoundsException("" + 11);
 
 		System.out.println((new long[3])[0]);
-		
+
 		byte[] negInt = Util.intToBytes(-3);
 		System.out.println(new BigInteger(negInt).intValue());
 	}

+ 50 - 0
test/protocols/TestSSCOT_C.java

@@ -0,0 +1,50 @@
+package protocols;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Arrays;
+
+public class TestSSCOT_C {
+
+	public static void main(String[] args) {
+		Runtime runTime = Runtime.getRuntime();
+		Process process = null;
+		String dir = System.getProperty("user.dir");
+		String binDir = dir + "\\bin";
+		String libs = dir + "\\lib\\*";
+		try {
+			process = runTime.exec("java -classpath " + binDir + ";" + libs + " ui.CLI -protocol sscot charlie");
+
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		InputStream inputStream = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(inputStream);
+		InputStream errorStream = process.getErrorStream();
+		InputStreamReader esr = new InputStreamReader(errorStream);
+
+		System.out.println("STANDARD OUTPUT:");
+		int n1;
+		char[] c1 = new char[1024];
+		try {
+			while ((n1 = isr.read(c1)) > 0) {
+				System.out.print(new String(Arrays.copyOfRange(c1, 0, n1)));
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+		System.out.println("STANDARD ERROR:");
+		int n2;
+		char[] c2 = new char[1024];
+		try {
+			while ((n2 = esr.read(c2)) > 0) {
+				System.err.print(new String(Arrays.copyOfRange(c2, 0, n2)));
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+
+}

+ 50 - 0
test/protocols/TestSSCOT_D.java

@@ -0,0 +1,50 @@
+package protocols;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Arrays;
+
+public class TestSSCOT_D {
+
+	public static void main(String[] args) {
+		Runtime runTime = Runtime.getRuntime();
+		Process process = null;
+		String dir = System.getProperty("user.dir");
+		String binDir = dir + "\\bin";
+		String libs = dir + "\\lib\\*";
+		try {
+			process = runTime.exec("java -classpath " + binDir + ";" + libs + " ui.CLI -protocol sscot debbie");
+
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		InputStream inputStream = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(inputStream);
+		InputStream errorStream = process.getErrorStream();
+		InputStreamReader esr = new InputStreamReader(errorStream);
+
+		System.out.println("STANDARD OUTPUT:");
+		int n1;
+		char[] c1 = new char[1024];
+		try {
+			while ((n1 = isr.read(c1)) > 0) {
+				System.out.print(new String(Arrays.copyOfRange(c1, 0, n1)));
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+		System.out.println("STANDARD ERROR:");
+		int n2;
+		char[] c2 = new char[1024];
+		try {
+			while ((n2 = esr.read(c2)) > 0) {
+				System.err.print(new String(Arrays.copyOfRange(c2, 0, n2)));
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+
+}

+ 50 - 0
test/protocols/TestSSCOT_E.java

@@ -0,0 +1,50 @@
+package protocols;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Arrays;
+
+public class TestSSCOT_E {
+
+	public static void main(String[] args) {
+		Runtime runTime = Runtime.getRuntime();
+		Process process = null;
+		String dir = System.getProperty("user.dir");
+		String binDir = dir + "\\bin";
+		String libs = dir + "\\lib\\*";
+		try {
+			process = runTime.exec("java -classpath " + binDir + ";" + libs + " ui.CLI -protocol sscot eddie");
+
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		InputStream inputStream = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(inputStream);
+		InputStream errorStream = process.getErrorStream();
+		InputStreamReader esr = new InputStreamReader(errorStream);
+
+		System.out.println("STANDARD OUTPUT:");
+		int n1;
+		char[] c1 = new char[1024];
+		try {
+			while ((n1 = isr.read(c1)) > 0) {
+				System.out.print(new String(Arrays.copyOfRange(c1, 0, n1)));
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+		System.out.println("STANDARD ERROR:");
+		int n2;
+		char[] c2 = new char[1024];
+		try {
+			while ((n2 = esr.read(c2)) > 0) {
+				System.err.print(new String(Arrays.copyOfRange(c2, 0, n2)));
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+
+}