I have a Axis2 web application which opens a raw socket to a 3rd party service. In the past this webapp has worked flawlessly.
I've recently (last couple of months) updated my JRE and this webapp no longer functions correctly.
In code we connect to a service over a raw socket and create a reader and writer for the input/output streams of the socket.
socket = new Socket("localhost", 8000);
output = new BufferedOutputStream(socket.getOutputStream());
writer = new PrintWriter(output, true);
input = new DataInputStream(new BufferedInputStream(socket.getInputStream()));
(I didn't write this code so don't ask ;))
The process is that a command string is written to the socket using 'writer.print(command + "\r\n")' and then we read a response using input.read() to build up a string buffer (we'd expect a response of "200 OK")...
As I said, this works when deployed as an aar under Axis2/Tomcat with older builds of Java (pre 1.6u37?) and it works when using the code directly from a main method in a test application. I've also connected to the 3rd party service using Putty and manually typed the commands and seen the responses come back there too.
Under newer versions of Java the call to input.read() immediately returns -1 indicating that the stream has reached its end instead of giving us any kind of response.
I'm starting to pull my hair out now. Does anyone know what may be going on?
(Even though there are no exceptions thrown I've tried using the catalina.policy file to grant all permissions to the webapp but it didn't have any effect...)