Use the default NDN() to connect to a random host on the testbed.
Remove the call to connectWebSocket.
Don't disable the button, since we connect after clicking it.
diff --git a/js/testing/test-get-async.html b/js/testing/test-get-async.html
index d3fbdd6..79407c2 100644
--- a/js/testing/test-get-async.html
+++ b/js/testing/test-get-async.html
@@ -13,12 +13,7 @@
<script type="text/javascript" src="../tools/build/ndn-js.js"></script>
<script type="text/javascript">
- var ndn = new NDN({port:9696,host:"localhost"});
- ndn.transport.connectWebSocket(ndn);
-
- ndn.onopen = function() {
- document.getElementById("testBtn").disabled = false;
- };
+ var ndn = new NDN();
var AsyncGetClosure = function AsyncGetClosure() {
// Inherit from Closure.
@@ -31,6 +26,7 @@
// Do nothing.
} else if (kind == Closure.UPCALL_CONTENT) {
console.log("Closure.upcall: content signature verification pass.");
+ console.log("Host: " + ndn.host + ":" + ndn.port);
var content = upcallInfo.contentObject;
//console.log(content.name);
nameStr = escape(content.name.getName());
@@ -43,12 +39,14 @@
} else if (kind == Closure.UPCALL_CONTENT_BAD) {
var content = upcallInfo.contentObject;
console.log("Closure.upcall: content signature verification fail.");
+ console.log("Host: " + ndn.host + ":" + ndn.port);
if (content.signature.signature)
console.log("Signature: " + DataUtils.toHex(content.signature.signature).toLowerCase());
if (content.signature.Witness)
console.log("Witness: " + DataUtils.toHex(content.signature.Witness).toLowerCase());
} else if (kind == Closure.UPCALL_INTEREST_TIMED_OUT) {
console.log("Closure.upcall called with interest time out.");
+ console.log("Host: " + ndn.host + ":" + ndn.port);
}
return Closure.RESULT_OK;
};
@@ -68,7 +66,7 @@
<input id="interest" type="text" name="INTEREST" size="50" value="/%C1.M.S.localhost/%C1.M.SRV/ccnd/KEY" />
</form>
- <button id="testBtn" onclick="run()" disabled="disabled">Fetch Content</button>
+ <button id="testBtn" onclick="run()">Fetch Content</button>
<p id="content">Content: <br/></p>
diff --git a/js/testing/test-publish-async.html b/js/testing/test-publish-async.html
index f69756a..70b60a9 100644
--- a/js/testing/test-publish-async.html
+++ b/js/testing/test-publish-async.html
@@ -15,11 +15,6 @@
<script type="text/javascript">
var ndn = new NDN();
- ndn.transport.connectWebSocket(ndn);
-
- ndn.onopen = function() {
- document.getElementById("testBtn").disabled = false;
- };
var AsyncPutClosure = function AsyncPutClosure() {
// Inherit from Closure.
@@ -31,6 +26,7 @@
// Do nothing.
} else if (kind == Closure.UPCALL_INTEREST) {
console.log('AsyncPutClosure.upcall() called.');
+ console.log("Host: " + ndn.host + ":" + ndn.port);
var content = document.getElementById('content').value;
var interest = upcallInfo.interest;
var nameStr = interest.name.getName();
@@ -50,10 +46,10 @@
function run() {
var contentName = document.getElementById('contentname').value;
- var result = ndn.registerPrefix(new Name(contentName), new AsyncPutClosure());
+ ndn.registerPrefix(new Name(contentName), new AsyncPutClosure());
document.getElementById('result').innerHTML = 'Content name \'' + contentName
- +'\' published. Result: ' + result;
+ +'\' published.';
}
</script>
@@ -74,7 +70,7 @@
</div>
</form>
<div>
- <button id="testBtn" onclick="run()" disabled="disabled">Publish Content</button>
+ <button id="testBtn" onclick="run()">Publish Content</button>
</div>
<p id="result"></p>