summaryrefslogtreecommitdiff
path: root/java/JACE/tests/Connection/HTTPHelperTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/JACE/tests/Connection/HTTPHelperTest.java')
-rw-r--r--java/JACE/tests/Connection/HTTPHelperTest.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/java/JACE/tests/Connection/HTTPHelperTest.java b/java/JACE/tests/Connection/HTTPHelperTest.java
new file mode 100644
index 00000000000..28967acb8d3
--- /dev/null
+++ b/java/JACE/tests/Connection/HTTPHelperTest.java
@@ -0,0 +1,34 @@
+package JACE.tests.Connection;
+
+import java.io.*;
+import JACE.Connection.*;
+import JACE.OS.*;
+
+public class HTTPHelperTest
+{
+ public static void main(String args[])
+ {
+ ACE.enableDebugging ();
+ // 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 = 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"));
+
+ String decoded = HTTPHelper.DecodeBase64 (encoded);
+ System.err.println("Decoded: \"" + decoded + '\"');
+
+ System.err.println("Is this right? " +
+ (decoded.equals (secret) ? "Yes" : "No"));
+ }
+}