Code example for ServerSocket

Methods: accept, sleep

0
        new Thread(new Runnable() {
            public void run() { 
                try { 
                    System.err.println("accepting...");
 
                    Socket client = ss.accept();
                    System.err.println("accepted...");
                    Thread.sleep(30 * 1000);
                    System.err.println("server exiting...");
                } catch (Exception ex) {
                    ex.printStackTrace();
                } 
            } 
        }).start();
        Socket s = new Socket();
        s.connect(ss.getLocalSocketAddress());
        new Killer(s).start();
        try { 
            System.err.println("write...");
            // We just keep writing here until all the buffers are full and we block, 
            // waiting for the server to read (which it never will). If the asynchronous close