I'm not sure if this is specific to Grizzly or HttpURLConnection.
I open a connection to grizzly with setDoInput(false). The request
is never sent to Grizzly. I'm suspecting this has something to do
with HttpURLConnection. Here's the code:
HttpURLConnection connection = (HttpURLConnection) new URL("http://
localhost:9999").openConnection();
connection.setRequestMethod("POST");
connection.setConnectTimeout(2); // ms timeout.
connection.setRequestProperty("Content-Type", "text/plain");
connection.setDoOutput(true);
connection.setDoInput(false);
PrintWriter writer = new PrintWriter(connection.getOutputStream());
writer.append(start.toString()).append(' ');
writer.append(duration.toString()).append("\r\n");
writer.flush();
writer.close();
// connection.getResponseCode(); // need to call this to get the
request to process.
If I un-comment the getResponseCode, everything works fine. I would
like to be able to post without waiting for a response.
Thank you,
-Noah