Description
Start server [1], conduct HeaderTest [2] on HARMONY and RI.
They prints out the following headers. Thereinto, RI has the "Accept" header, while HARMONY doesn't.
On RI:
GET / HTTP/1.1
User-Agent: Java/1.6.0_07
Host: 127.0.0.1:8030
Accept: text/html, image/gif, image/jpeg, ; q=.2, */; q=.2
Connection: keep-alive
On HARMONY:
GET / HTTP/1.1
User-Agent: Java/1.6.0_07
Host: 127.0.0.1:8030
Connection: keep-alive
[1] Server
public class MockServer {
public static void main(String[] args)
public void await() {
ServerSocket serverSocket = null;
int port = 8030;
try
catch (IOException e)
{ e.printStackTrace(); System.exit(1); } // Loop waiting for a request
while (true) {
Socket socket = null;
InputStream input = null;
OutputStream output = null;
try {
socket = serverSocket.accept();
input = socket.getInputStream();
output = socket.getOutputStream();
Scanner in = new Scanner(input);
PrintWriter out = new PrintWriter(output, true);
while (in.hasNextLine())
// Close the socket
socket.close();
// check if the previous URI is a shutdown command
} catch (IOException e)
}
}
}
[2] HeaderTest
public class HeaderTest {
public static void main(String[] args) throws IOException
}