示例#1
0
        public static void Has(IDictionary <string, string> dict, string[] args)
        {
            if (args == null || args.Length == 0)
            {
                args = new string[] { "ipc", "pgm", "tipc", "norm", "curve", "gssapi" };
            }

            foreach (string arg in args)
            {
                Console.WriteLine("{0}: {1}", arg, ZContext.Has(arg));
            }
        }
示例#2
0
        public void SetOption_GSSAPIPrincipal()
        {
            if (!ZContext.Has("gssapi"))
            {
                Assert.Ignore("libzmq does not support gssapi");
            }

            DoWithUnconnectedPairSocket(socket =>
            {
                socket.GSSAPIPrincipal = "foo";
                Assert.AreEqual("foo", socket.GSSAPIPrincipal);
            });
        }
示例#3
0
        public void SetOption_GSSAPIPlainText()
        {
            if (!ZContext.Has("gssapi"))
            {
                Assert.Ignore("libzmq does not support gssapi");
            }

            DoWithUnconnectedPairSocket(socket =>
            {
                socket.GSSAPIPlainText = true;
                Assert.AreEqual(true, socket.GSSAPIPlainText);
            });
        }
示例#4
0
 public void Static_Has()
 {
     // we should not assert on the result of these capabilities, since different builds of
     // the libzmq dynamic library should be allowed
     Console.WriteLine("Loaded libzmq dynamic library has the following capabilities:");
     Console.WriteLine(string.Format("ipc: {0}", ZContext.Has("ipc")));
     Console.WriteLine(string.Format("pgm: {0}", ZContext.Has("pgm")));
     Console.WriteLine(string.Format("tipc: {0}", ZContext.Has("tipc")));
     Console.WriteLine(string.Format("norm: {0}", ZContext.Has("norm")));
     Console.WriteLine(string.Format("curve: {0}", ZContext.Has("curve")));
     Console.WriteLine(string.Format("gssapi: {0}", ZContext.Has("gssapi")));
     Console.WriteLine(string.Format("draft: {0}", ZContext.Has("draft")));
 }
示例#5
0
 public void GetOption_GSSAPIPrincipal()
 {
     DoWithUnconnectedPairSocket(socket =>
     {
         if (!ZContext.Has("gssapi"))
         {
             Assert.Throws <ZException>(() => { var res = socket.GSSAPIPrincipal; });
         }
         else
         {
             Assert.IsEmpty(socket.GSSAPIPrincipal);
         }
     });
 }
示例#6
0
 public void GetOption_GSSAPIPlainText()
 {
     DoWithUnconnectedPairSocket(socket =>
     {
         if (!ZContext.Has("gssapi"))
         {
             Assert.Throws <ZException>(() => { var res = socket.GSSAPIPlainText; });
         }
         else
         {
             Assert.AreEqual(false, socket.GSSAPIPlainText);
         }
     });
 }
示例#7
0
        public void SetOption_CurveSecretKey()
        {
            if (!ZContext.Has("curve"))
            {
                Assert.Ignore("Ignored due to missing curve support");
            }
            Assume.That(PlatformKind.Win32 == Platform.Kind); // TODO: fix the test and remove this

            DoWithUnconnectedPairSocket(socket =>
            {
                // TODO: the interface is confusing; Z85-encoded keys should always be strings
                byte[] publicKeyZ85, secretKeyZ85;
                Z85.CurveKeypair(out publicKeyZ85, out secretKeyZ85);
                socket.CurveSecretKey  = secretKeyZ85;
                byte[] secretKeyBinary = Z85.Decode(secretKeyZ85);
                CollectionAssert.AreEqual(secretKeyBinary, socket.CurveSecretKey);
            });
        }