title: Jenkins Windows Slave JNLP connect error
body: <p>I am trying to configure a jenkins slave on a windows vm and keep it running as a service. I did the following steps </p>
  
  <ol>
  <li><p>went to the jenkins master from my slave and downloaded the jnlp slave agent and installed it. Got connected on the jenkins logs in the master. and the small window to show i am connected came up too.</p>
  
  <p>JNLP agent connected from /10.xx8
  &lt;===[JENKINS REMOTING CAPACITY]===>Slave.jar version: 2.51
  This is a Windows slave
  Slave successfully connected and online</p></li>
  </ol>
  
  <p>After this i installed it as a service with the jenkins user that i use. On closing the small connected window on my slave I get the following error </p>
  
  <pre><code>Failing to obtain https://my netowrk.com/computer/Windows%20Slave/slave-agent.jnlp?encrypt=true
  java.net.ConnectException: Connection refused: connect
      at java.net.DualStackPlainSocketImpl.connect0(Native Method)
      at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
      at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
      at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
      at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
      at java.net.PlainSocketImpl.connect(Unknown Source)
      at java.net.SocksSocketImpl.connect(Unknown Source)
      at java.net.Socket.connect(Unknown Source)
      at sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
      at sun.security.ssl.BaseSSLSocketImpl.connect(Unknown Source)
      at sun.net.NetworkClient.doConnect(Unknown Source)
      at sun.net.www.http.HttpClient.openServer(Unknown Source)
      at sun.net.www.http.HttpClient.openServer(Unknown Source)
      at sun.net.www.protocol.https.HttpsClient.&lt;init&gt;(Unknown Source)
      at sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
      at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source)
      at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
      at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
      at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source)
      at hudson.remoting.Launcher.parseJnlpArguments(Launcher.java:269)
      at hudson.remoting.Launcher.run(Launcher.java:219)
      at hudson.remoting.Launcher.main(Launcher.java:192)
  Waiting 10 seconds before retry
  </code></pre>
  
  <p>I then added the proxy settings to my jenkins-slave .xml but still get the same error. My jenkins-slave.xml arguments are as follows</p>
  
  <pre><code>&lt;executable&gt;C:\Program Files\Java\jre7\bin\java.exe&lt;/executable&gt;
    &lt;arguments&gt;-Xrs -Dhttp.proxyHost=xx.xx.xx -
  
  Dhttp.proxyPort=3128 -jar "%BASE%\slave.jar" -jnlpUrl https://example.org/computer/Windows%20Slave/slave-
  
  agent.jnlp -secret dxxxxxxxxxxxxa2d -noCertificateCheck&lt;/arguments&gt;
  </code></pre>
  
  <p>Can anyone provide some advice as to how to resolve this. </p>
  
  <p>Thanks</p>