public void start() throws IOException {
        myServerSocket = new ServerSocket();
        myServerSocket.bind((hostname != null) ? new InetSocketAddress(hostname, myPort) : new InetSocketAddress(myPort));

        myThread = new Thread(new Runnable() {
            @Override
            public void run() {
                do {
                    try {
                        final Socket finalAccept = myServerSocket.accept();
                        InputStream inputStream = finalAccept.getInputStream();
                        OutputStream outputStream = finalAccept.getOutputStream();
                        TempFileManager tempFileManager = tempFileManagerFactory.create();
                        final HTTPSession session = new HTTPSession(tempFileManager, inputStream, outputStream);
                        asyncRunner.exec(new Runnable() {
                            @Override
                            public void run() {
                                session.run();
                                try {
                                    finalAccept.close();
                                } catch (IOException ignored) {
                                }
                            }
                        });
                    } catch (IOException e) {
                    }
                } while (!myServerSocket.isClosed());
            }
        });
        myThread.setDaemon(true);
        myThread.setName("NanoHttpd Main Listener");
        myThread.start();
    }