title: Apns notification error: 'ConnectionError' and Failed to Connect, check your firewall settings
body: <p>I am working with PushSharp 4.0.10  and using .p12 certificate i get this error <strong><a href="https://i.stack.imgur.com/FqLIn.png" rel="nofollow noreferrer"><em>"Apns notification error: 'ConnectionError'"</a></em></strong> and InnerException is <strong><em>"Failed to Connect, check your firewall settings"</em></strong>.is anyone knows how to solve this error. </p>
  
  <p>protected void Page_Load(object sender, EventArgs e){</p>
  
  <pre><code>    var certificate = System.IO.File.ReadAllBytes(System.Web.Hosting.HostingEnvironment.MapPath("~/jetzydev.p12"));
      var config = new ApnsConfiguration(ApnsConfiguration.ApnsServerEnvironment.Sandbox, certificate, "12345");
  
      var apnsBroker = new ApnsServiceBroker(config);
      var fbs = new FeedbackService(config);
  
      apnsBroker.OnNotificationFailed += (Notification, aggregateEx) =&gt;
      {
          aggregateEx.Handle(ex =&gt;
          {
              if (ex is ApnsNotificationException)
              {
                  var notificationException = (ApnsNotificationException)ex;
                  var apnsNotification = notificationException.Notification;
                  var statusCode = notificationException.ErrorStatusCode;
              }
  
              return true;
          });
      };
  
      apnsBroker.OnNotificationSucceeded += (Notification) =&gt;
      {
          Response.Write("done");
          //  logger.Debug("Apple Notification Sent!");                  
      };
  
      // Start the broker
      apnsBroker.Start();
  
  
      try
      {
          apnsBroker.QueueNotification(new ApnsNotification()
          {
              DeviceToken="---------------------------------------",
              Payload = JObject.Parse("{\"aps\":{\"alert\":{\"body\": \"This is message from local host 1\",\"title\": \"title\"},\"sound\":\"beep.wav\"}}")
          });
          apnsBroker.Stop();
  
      }
      catch (Exception ex)
      {
          Response.Write(ex);
          //logger.Debug(" SendPushNotificationToApple :- " + ex.Message);
      }
  
  }
  </code></pre>