Permalink
Browse files

Add ping test

  • Loading branch information...
1 parent 3d60aee commit 5061ca93c57826d5d4d7088938568e57da7ee995 @njoyce njoyce committed Oct 14, 2011
@@ -0,0 +1 @@
+Test to ensure that rtmp ping succeeds.
@@ -0,0 +1,9 @@
+application.onConnectAccept(newClient)
+{
+ if (newClient.ping())
+ {
+ newclient.call('ping_success')
+ } else {
+ newclient.call('ping_failure')
+ }
+}
@@ -0,0 +1,24 @@
+from rtmpy import server
+
+
+class Application(server.Application):
+ """
+ """
+
+ def onConnectAccept(self, client, *args):
+ def cb(ret):
+ if ret:
+ client.call('ping_success')
+ else:
+ raise RuntimeError('ping failed!')
+
+ def eb(f):
+ client.call('ping_failure')
+
+ return f
+
+
+ d = client.ping()
+
+ d.addCallback(cb)
+ d.addErrback(eb)
@@ -0,0 +1,25 @@
+package {
+ import meerkat.TestCase;
+
+
+
+ public class main extends TestCase
+ {
+ public override function run():void
+ {
+ this.nc.client = this;
+ this.nc.connect(this.serverUrl);
+
+ }
+
+ public function ping_success():void
+ {
+ this.success();
+ }
+
+ public function ping_failure():void
+ {
+ this.failure();
+ }
+ }
+}

0 comments on commit 5061ca9

Please sign in to comment.