I am trying to programmatically (Java) open a URL that points to a modem on the network. I am connected to the network and can ping the device as well as fetch the URL within a browser. However, programmatically, I get the following stack trace when trying to open the connection.
java.net.SocketException: Software caused connection abort: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:550)
at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:141)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:272)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:329)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:172)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:793)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:158)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1041)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
Also, the URL uses the https protocol.
Here is my code:
try {
URL jipmURL = new URL("https://xxx.xxx.xxx.xxx/login.cgi");
URLConnection urlConnection = jipmURL.openConnection();
InputStreamReader streamReader = new InputStreamReader(
jipmURLConnection.getInputStream());
BufferedReader in = new BufferedReader(streamReader);
StringBuffer stringBuffer = new StringBuffer();
String inputLine;
while ((inputLine = in.readLine()) != null) {
stringBuffer.append(inputLine);
}
System.out.println("Results: " + stringBuffer);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
Any help would be appreciated,
Steve