title: RabbitMQ DotNet Client does not connect to SSL
body: <p>We are trying to make a PoC showing that applications written in different languages can communicate through RabbitMQ broker in one organization. We run vanilla RabbitMQ docker image <strong>rabbitmq:3.6.1-management</strong> and vanilla haproxy docker image <strong>haproxy:1.6.5</strong> that does SSL:</p>
  
  <pre><code>frontend amqp_front
      bind *:5672 tcp-ut 5s
      mode tcp
      timeout client 60s
      timeout client-fin 1s
      no option clitcpka
      default_backend amqp_back
  
  frontend amqp_front_ssl
      bind *:5671 tcp-ut 5s ssl crt /etc/certs/haproxy/rmq.pem ca-file /etc/certs/haproxy/root.crt verify required
      mode tcp
      timeout client 60s
      timeout client-fin 1s
      no option clitcpka
      acl client ssl_c_s_dn(CN) -m str cli
      tcp-request content reject if !client
      default_backend amqp_back
  </code></pre>
  
  <p>RabbitMQ config is:</p>
  
  <pre><code>[
    {rabbit,
      [
        { tcp_listeners, [ 5672 ] },
        { ssl_listeners, [ ] },
        {default_pass, &lt;&lt;"pwd"&gt;&gt;},
        {default_user, &lt;&lt;"usr"&gt;&gt;},
        {default_vhost, &lt;&lt;"default"&gt;&gt;},
        {loopback_users, []}
      ]
    },
    { rabbitmq_management, [
        { listener, [
          { port, 15672 },
          { ssl, false }
          ]
        }
      ]
    }
  ].
  </code></pre>
  
  <p>We have written a trivial code in <strong>Go</strong> &amp; <strong>Node.js</strong>, that both load root.crt, cli.crt &amp; cli.key and successfully connect to SSL port 5671 and consume.</p>
  
  <p>Attempt to write the same trivial code in .Net, using RabbitMQ.Client.dll (version 3.6.0, 3.6.1, 3.6.2) failed though:</p>
  
  <pre><code>X509Store store = new X509Store (StoreName.Root, StoreLocation.LocalMachine);
  store.Open (OpenFlags.ReadOnly);
  
  var factory = new ConnectionFactory ();
  factory.Ssl.Enabled = true;
  factory.Ssl.ServerName = "rmq";
  factory.Ssl.Certs = store.Certificates;
  factory.Ssl.CertPassphrase = "";
  factory.HostName = "localhost";
  factory.Port = 5671;
  factory.UserName = "usr";
  factory.Password = "pwd";
  factory.VirtualHost = "default";
  
  var conn = factory.CreateConnection ()
  </code></pre>
  
  <p>What happens is .Net client simply ignores port 5671 disregarding the settings above, it just goes to 5672. If 5672 is open - connects to it, and if 5672 is closed - fails with connection refused. </p>
  
  <p>Code in Go and Node.js prove that my SSL setup is valid. 
  Error of .Net client shows that SSL stuff does not even have a chance to jump in.</p>
  
  <p>I'm on debian jessie &amp; Mono. </p>
  
  <p>Am I missing something obvious? </p>