summaryrefslogtreecommitdiff
path: root/test/disabled
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-12-01 13:00:04 -0800
committerRyan Dahl <ry@tinyclouds.org>2010-12-01 13:00:17 -0800
commitd8f2880ca46b12c1e39f13c3a7e91b3bc910a98b (patch)
tree651020908cce8662abd2b90e15b84fa79cf5a575 /test/disabled
parentec1589875ce31ebd7a230aa5865f56cffb547e95 (diff)
downloadandroid-node-v8-d8f2880ca46b12c1e39f13c3a7e91b3bc910a98b.tar.gz
android-node-v8-d8f2880ca46b12c1e39f13c3a7e91b3bc910a98b.tar.bz2
android-node-v8-d8f2880ca46b12c1e39f13c3a7e91b3bc910a98b.zip
New TLS server API
Diffstat (limited to 'test/disabled')
-rw-r--r--test/disabled/test-tls-server.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/disabled/test-tls-server.js b/test/disabled/test-tls-server.js
new file mode 100644
index 0000000000..394bc9201b
--- /dev/null
+++ b/test/disabled/test-tls-server.js
@@ -0,0 +1,29 @@
+// Example of new TLS API. Test with:
+//
+// openssl s_client -connect localhost:12346 -key test/fixtures/agent.key -cert test/fixtures/agent.crt
+// openssl s_client -connect localhost:12346
+//
+var common = require('../common');
+var tls = require('tls');
+var fs = require('fs');
+var join = require('path').join;
+
+var key = fs.readFileSync(join(common.fixturesDir, "agent.key")).toString();
+var cert = fs.readFileSync(join(common.fixturesDir, "agent.crt")).toString();
+
+s = tls.Server({ key: key, cert: cert, unauthorizedPeers: false });
+
+s.listen(common.PORT, function () {
+ console.log("TLS server on 127.0.0.1:%d", common.PORT);
+});
+
+
+s.on('authorized', function (c) {
+ console.log("authed connection");
+ c.end("bye authorized friend.\n");
+});
+
+s.on('unauthorized', function (c, e) {
+ console.log("unauthed connection: %s", e);
+ c.end("bye unauthorized person.\n");
+});