title: Java how to handle HTTP GET request after establishing TCP connection
body: <p>So after establishing my listening for a connection and accepting one:</p>
  
  <pre><code>ServerSocket serverSock = new ServerSocket(6789);
  Socket sock = serverSock.accept();
  </code></pre>
  
  <p>When I type into my browser <code>localhost:6789/index.html</code> how do I handle this incoming GET request and return <code>index.html</code>? <code>index.html</code> is in the same directory.</p>
  
  <p>Firstly I want to very that <code>index.html</code> actually exists and if not I return a HTTP 404 message. Then I will close the connection.</p>