-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for TLS socket connections (#60)
- Loading branch information
Showing
3 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
var nodeq = require("../index.js"), | ||
assert = require("assert") | ||
|
||
describe("tls", function() { | ||
"use strict" | ||
it("should fail if endpoint expects tls and we don't set useTLS to true", function(done) { | ||
nodeq.connect({host: "localhost", port: 6000}, function(err) { | ||
assert.ok(err) | ||
done() | ||
}); | ||
}); | ||
|
||
it("should connect successfully if useTLS is true", function(done) { | ||
nodeq.connect({host: "localhost", port: 6000, useTLS: true}, function(err) { | ||
if (err) { throw err } | ||
done() | ||
}); | ||
}) | ||
|
||
it("should fail if useTLS is true and endpoint doesn't expect it", function(done) { | ||
nodeq.connect({host: "localhost", port: 5000, useTLS: true}, function(err) { | ||
assert.ok(err) | ||
done() | ||
}); | ||
}) | ||
}); |