title: Spring MVC giving Connection refused when connecting to REST service with Https
body: <p>Server Side:
  I have a REST service running on my Ubuntu Laptop ,its a spring boot app with the below in the application properties </p>
  
  <pre><code>server.port: 8443
  server.ssl.key-store: keystore.p12
  server.ssl.key-store-password: mypassword
  server.ssl.keyStoreType: PKCS12
  server.ssl.keyAlias: tomcat
  server.address:&lt;My Ip Address&gt;
  </code></pre>
  
  <p>Client Side Code:
  I created a Web app which calls the Rest service ,and I have configured it to run on Https .Web app is running on Mac Laptop and I have configured in my Web APP.Web APP is a Spring MVC application.</p>
  
  <pre><code>HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier()
          {
              public boolean verify(String hostname, SSLSession session)
              {
                  // ip address of the service URL(like.23.28.244.244)
                  if (hostname.equals("10.0.0.191"))
                      return true;
                  return false;
              }
          });
  </code></pre>
  
  <p>When i Click a button on the web page which calls the REST service (which is running on my ubuntu laptop) I get the below exception</p>
  
  <pre><code>org.springframework.web.client.ResourceAccessException: I/O error: Connection refused; nested exception is java.net.ConnectException: Connection refused
      at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:461)
      at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:409)
      at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:385)
      at com.pcap.webapp.HomeController.getPcapInfo(HomeController.java:172)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  </code></pre>
  
  <p>So in brief My issue is How do I call my REST service (which is https ,running on ubuntu ,Spring boot ) from my web application (Spring MVC,https,Mac Laptop)</p>