コード例 #1
0
 MQConnection connectToServer(Uri uri, string user, string password)
 {
     try {
         MQConnection con = MQBuilder.BuildConnection(uri, user, password);
         Assert.IsTrue(con != null, "Successfully Connected");
         return(con);
     } catch (Exception e) {
         Assert.IsTrue(e == null, e.ToString());
     }
     return(null);
 }
コード例 #2
0
        public void test_EmptyPassword()
        {
            SSLContext   ctx = setupSSL();
            MQConnection con;

            try {
                con = MQBuilder.BuildConnection(simpleAddress, user, "", ctx);
                con.Close();
            } catch (Exception e) {
                Assert.IsTrue(e == null, "Connect attempt with x.509 ident, name empty password " + e.ToString());
            }
        }
コード例 #3
0
        public void test_NullLogin()
        {
            SSLContext   ctx = setupSSL();
            MQConnection con;

            try {
                con = MQBuilder.BuildConnection(simpleAddress, null, null, ctx);
                con.Close();
            } catch (Exception e) {
                Assert.IsTrue(e == null, "Reconnect with x.509 ident null ident " + e.ToString());
            }
        }
コード例 #4
0
        public void test_BadPassword()
        {
            SSLContext   ctx = setupSSL();
            MQConnection con;

            try {
                con = MQBuilder.BuildConnection(simpleAddress, user, "12345", ctx);
                con.Close();
            } catch (MQException e) {
                Assert.IsTrue(e.getErrorcode() == ErrorCode.EC_NOTAUTHORIZED, "Reconnect with x.509 ident, name wrong password" + e.ToString());
            } catch (Exception e) {
                Assert.IsTrue(false, "Connect attempt with x.509 ident, name wrong password" + e.ToString()); // this is the correct case
            }
        }
コード例 #5
0
        MQConnection connectToServer(Uri uri, string user, string password)
        {
            try {
                SSLContext ctx = new SSLContext();
                ctx.ServerValidator = SafmqSSLTest.ServerValidator;

                MQBuilder.ctx = ctx;

                MQConnection con = MQBuilder.BuildConnection(uri, user, password);
                Assert.IsTrue(con != null, "Successfully Connected");
                return(con);
            } catch (Exception e) {
                Assert.IsTrue(e == null, e.ToString());
            }
            return(null);
        }
コード例 #6
0
        public void test_DefaultSharedContext()
        {
            SSLContext   ctx = setupSSL();
            MQConnection con;

            MQBuilder.ctx = ctx;

            try {
                con = MQBuilder.BuildConnection(simpleAddress, null, null);
                con.Close();
            } catch (Exception e) {
                Assert.IsTrue(e == null, "Connect attempt with x.509 ident null ident" + e.ToString());
            }

            try {
                con = MQBuilder.BuildConnection(simpleAddress, "", "");
                con.Close();
            } catch (Exception e) {
                Assert.IsTrue(e == null, "Connect attempt with x.509 ident empty string" + e.ToString());
            }

            try {
                con = MQBuilder.BuildConnection(simpleAddress, user, null);
                con.Close();
            } catch (Exception e) {
                Assert.IsTrue(e == null, "Connect attempt with x.509 ident name, null password" + e.ToString());
            }

            try {
                con = MQBuilder.BuildConnection(simpleAddress, user, "");
                con.Close();
            } catch (Exception e) {
                Assert.IsTrue(e == null, "Connect attempt with x.509 ident, name empty password" + e.ToString());
            }

            try {
                con = MQBuilder.BuildConnection(simpleAddress, user, "12345");
                con.Close();
            } catch (MQException e) {
                Assert.IsTrue(e.getErrorcode() == ErrorCode.EC_NOTAUTHORIZED, "Reconnect with x.509 ident, name wrong password" + e.ToString());
            } catch (Exception e) {
                Assert.IsTrue(e != null, "Connect attempt with x.509 ident, name wrong password" + e.ToString());
            }
        }