I wrote a very simple Java http server for exercising purposes. I test it with cURL and everything seems to work fine but when I try to send a request from a browser
http://localhost:6666/
the server does not respond. I even put a marking System.out.println() at the point when the server socket accepts a connection which doesn't seem to fire when i try to hit the server through a browser. Please help me out with this. Thanks :)
EDIT: Part of the code:
public class Server {
private ServerSocket serverSocket;
private Socket socket;
public Server() {
try {
serverSocket = new ServerSocket(6666);
while (true) {
socket = serverSocket.accept();
System.out.println("Whoop! Connection!");
Request request = new Request(socket);
request.run();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
Where Request is a class which extends Thread in order to handle multiple requests