import java.net.*; public class Http { private static final String EOL = "\r\n"; public static void main(String args[]) throws Exception { ServerSocket server = new ServerSocket(8911); while (true) { Socket sock = server.accept(); sock.getOutputStream().write(("HTTP/1.0 " + HttpURLConnection.HTTP_OK + EOL + "Content-type: text/html" + EOL + EOL + "Some example text").getBytes()); sock.close(); } } }