Q: Serversocket accepts more connections as it should from the same client I want to make a simple http response without much to it, but it somehow screwes up. It makes around 3 connections but sometimes sending the 2nd or 3rd response before the request when i checked it with Wireshark. I am confused big time!
Here is the code:
public static int letThrough() throws IOException
{
    ServerSocket serverSocket = new ServerSocket(80);
    Socket connectionSocket = null;  
    while(running)
    {
        connectionSocket = serverSocket.accept();
        System.out.println("Client: " + connectionSocket.getPort());

        makeSession(connectionSocket);
    }
    serverSocket.close();
    return 1;
}

static public Runnable makeSession(Socket connectionSocket)
{
    Runnable rSession = new Runnable(){
        @Override
        public void run()
        {
            try
            {
            String clientIp = connectionSocket.getInetAddress().getHostAddress();
            System.out.println("Client verbunden... (" + clientIp + ")");
            PrintWriter oPWriter;

            oPWriter = new PrintWriter(connectionSocket.getOutputStream(), false);

            System.out.println("Streams erstellt...");

            Date today = new Date();
            Thread.sleep(10);
            oPWriter.println("HTTP/1.1 200 OK");
            oPWriter.println("Content-Type: text/html");
            oPWriter.println("Server: Bot");
            // this blank line signals the end of the headers
            oPWriter.println("");
            // Send the HTML page
            oPWriter.println("<H1>Welcome to the Ultra Mini-WebServer</H2><br><H2>"+today.toString());
            oPWriter.flush();
            oPWriter.close();

            connectionSocket.shutdownOutput();
            while(connectionSocket.isOutputShutdown() == false)
            {
                Thread.sleep(100);
            }
            connectionSocket.close();
            while(connectionSocket.isClosed() == false)
            {
                Thread.sleep(100);
            }

            }
            catch (IOException | InterruptedException e)
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

    };

    new Thread(rSession).start();
    return rSession;
}

I tried already some things, like the last two while-loops with sleep. Any Idea how i even can debug this?

A: Problem found! There was no real Problem with my code, it was the stupid chrome browser establishing connnections without using them. Or maybe there used for secret things that i cant see.
