Package org.xsocket

Examples of org.xsocket.WorkerPool


    public void testCorePoolSize0() throws Exception {
  
        HttpServer server = new HttpServer(0, new WebHandler(), 0, 40);
        server.start();
       
        WorkerPool pool = ((WorkerPool) server.getWorkerpool());
       

        BlockingConnection bc = new BlockingConnection("localhost", server.getLocalPort());

        bc.write("GET /0123456 HTTP/1.1\r\n"+
                 "Host: localhost:" + server.getLocalPort() + "\r\n"+
                 "User-Agent: xLightweb/2.11\r\n"+
                 "Upgrade: WebSocket\r\n"+
                 "Connection: Upgrade\r\n"+
                 "Origin: http://localhost:5161/\r\n"+
                 "\r\n");

        System.out.println(bc.readStringByDelimiter("\r\n\r\n"));
       
        for (int i = 0; i < 10; i++) {
            bc.write(new byte[] { 0x00, 0x48, 0x65, (byte) 0xFF});

            byte[] b = bc.readBytesByLength(4);
            Assert.assertArrayEquals(new byte[] { 0x00, 0x48, 0x65, (byte) 0xFF}, b);
           
            QAUtil.sleep(250);
        }

       
        System.out.println(pool.getLargestPoolSize());
       
        bc.close();
        server.close();
    }    
View Full Code Here

TOP

Related Classes of org.xsocket.WorkerPool

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.