summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authoreea1 <eea1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-05-13 17:19:29 +0000
committereea1 <eea1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-05-13 17:19:29 +0000
commitb9944d5877277ffc7bc9f9f5bf8c2bfa3e9595cf (patch)
tree257ed1d17ca4b1fcd9ccafa38256db6f7963655b /java
parentdce86101b04de92af9cb9e3876c0697c18695cb9 (diff)
downloadATCD-b9944d5877277ffc7bc9f9f5bf8c2bfa3e9595cf.tar.gz
Added the test for HTTPHelper, corrected a deprecation (DataInputStream
readLine) deprecation warning.
Diffstat (limited to 'java')
-rw-r--r--java/tests/Connection/ClientHandler.java3
-rw-r--r--java/tests/Connection/HTTPHelperTest.java27
-rw-r--r--java/tests/Connection/Makefile4
3 files changed, 32 insertions, 2 deletions
diff --git a/java/tests/Connection/ClientHandler.java b/java/tests/Connection/ClientHandler.java
index 702c633ceca..a18f7740cce 100644
--- a/java/tests/Connection/ClientHandler.java
+++ b/java/tests/Connection/ClientHandler.java
@@ -31,7 +31,8 @@ public class ClientHandler extends SvcHandler
public void run ()
{
- DataInputStream in = new DataInputStream (System.in);
+ BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
+
String msg;
StringBuffer ack = new StringBuffer ();
int ack_len;
diff --git a/java/tests/Connection/HTTPHelperTest.java b/java/tests/Connection/HTTPHelperTest.java
new file mode 100644
index 00000000000..02a16d838af
--- /dev/null
+++ b/java/tests/Connection/HTTPHelperTest.java
@@ -0,0 +1,27 @@
+package tests.Connection;
+
+import java.io.*;
+import JACE.Connection.*;
+
+public class HTTPHelperTest
+{
+ public static void main(String args[])
+ {
+ // This is just a quick test to confirm that the Base 64 encoding and decoding work
+ // (tests the example given in the HTTP 1.1 RFC)
+
+ String secret = "Aladdin:open sesame";
+
+ String encoded = JACE.Connection.HTTPHelper.EncodeBase64(secret);
+
+ System.err.println("Encoding string: " + secret);
+
+ System.err.println("Result: " + encoded);
+
+ System.err.println("Is this right? " + (encoded.equals("QWxhZGRpbjpvcGVuIHNlc2FtZQ==") ? "Yes" : "No"));
+
+ // Decode should also be tested
+ //
+ }
+};
+
diff --git a/java/tests/Connection/Makefile b/java/tests/Connection/Makefile
index de076f71237..f58878033e0 100644
--- a/java/tests/Connection/Makefile
+++ b/java/tests/Connection/Makefile
@@ -1,4 +1,5 @@
# Makefile
+# $Id$
.SUFFIXES: .java .class
@@ -16,7 +17,8 @@ doc:
files = ServerHandler.java \
ClientHandler.java \
ConnectorTest.java \
- AcceptorTest.java
+ AcceptorTest.java \
+ HTTPHelperTest.java
packages = tests.Connection