I am having a problem with my connection to Elastic Beanstalk server. I am running a server on AWS Elastic Beanstalk with a simple call as followed:
app.get('/WhatIsCool?', function (req, res) {
res.send("You are cool!!!")
})
and on the Java side I have
public String testing() {
try {
URL http = new URL(urladdress + "/WhatIsCool");
HttpURLConnection openCon = (HttpURLConnection) http.openConnection();
System.out.println(http);
openCon.setRequestMethod("GET");
openCon.setDoOutput(true);
openCon.setConnectTimeout(60 * 1000);
openCon.setReadTimeout(60 * 1000);
System.out.println("Well I got this far.");
BufferedReader br = new BufferedReader(new InputStreamReader(openCon.getInputStream()));
System.out.println("Can I get this far?");
while ((inputLine = br.readLine()) != null) {
System.out.println("What is cool? " + inputLine);
return inputLine;
}
br.close();
return null;
} catch (IOException e1) {
e1.printStackTrace();
return "Error: " + e1;
}
}
but for some reason I keep getting an error on right after the line that says "Well I go this far" I am unsure what I am doing wrong I have tried so many different things online but none of them seem to work. I should also mention that when I run it locally it works just fine.