Package org.xsocket.connection

Examples of org.xsocket.connection.BlockingConnection.readStringByLength()


    QAUtil.sleep(500);
   
    String header = con.readStringByDelimiter("\r\n\r\n") + "\r\n";
    int contentLength = QAUtil.readContentLength(header);
   
    String body = con.readStringByLength(contentLength);
    Assert.assertTrue(header.indexOf("200") != -1);
    Assert.assertEquals("1234", body);
   

View Full Code Here


          "1234");
     
   
    String header = con.readStringByDelimiter("\r\n\r\n") + "\r\n";
    int contentLength = QAUtil.readContentLength(header);
    con.readStringByLength(contentLength);
   
    Assert.assertTrue(header.indexOf("404") != -1);
  }

View Full Code Here

          "1234");
     
   
    String header = con.readStringByDelimiter("\r\n\r\n") + "\r\n";
    int contentLength = QAUtil.readContentLength(header);
    con.readStringByLength(contentLength);
   
    Assert.assertTrue(header.indexOf("404") != -1);
    Assert.assertTrue(doNothingFilter.isOnResponseCalled());
  }
View Full Code Here

     
   
    String header = con.readStringByDelimiter("\r\n\r\n") + "\r\n";
    Assert.assertTrue(header.indexOf("200") != -1);
    Assert.assertTrue(header.indexOf("Connection: close") != -1);
    Assert.assertEquals("<html>this ...", con.readStringByLength(14));
   
    try {
      con.readByte();
      Assert.fail("ClosedChannelException expected");
    } catch (ClosedChannelException expected) { }
View Full Code Here

    con.write("GET /test HTTP/1.0\r\n");
    con.write("\r\n");
   
    String header = con.readStringByDelimiter("\r\n\r\n");
    Assert.assertTrue(header.indexOf("OK") != -1);
    Assert.assertEquals("test123456", con.readStringByLength(10));
   
    try {
      con.readByte();
      Assert.fail("ClosedChannelException expected");
    } catch (ClosedChannelException expected) { }
View Full Code Here

    String header = con.readStringByDelimiter("\r\n\r\n") + "\r\n";
    System.out.println("header received");
   
    int contentLength = QAUtil.readContentLength(header);
     
    String body = con.readStringByLength(contentLength);

    Assert.assertTrue(header.indexOf("200") != -1);
    Assert.assertEquals("OK", body);
   
   
View Full Code Here

   
    String header = con.readStringByDelimiter("\r\n\r\n") + "\r\n";
    System.out.println("header received");
    int contentLength = QAUtil.readContentLength(header);
     
    String body = con.readStringByLength(contentLength);

    Assert.assertTrue(header.indexOf("200") != -1);
    Assert.assertEquals("OK", body);
   
   
View Full Code Here

       
        for (int i = 0; i < 10; i++) {
            String header = con.readStringByDelimiter("\r\n\r\n");
            Assert.assertTrue(header.indexOf("200") != -1);
            // content length is 1
            int num = Integer.parseInt(con.readStringByLength(1));
            Assert.assertEquals(i, num);
        }
       
        con.close();
        server.close();
View Full Code Here

    header = con.readStringByDelimiter("\r\n\r\n") + "\r\n";
   
    System.out.println("got 2.te response header");
    int contentLength = QAUtil.readContentLength(header);
     
    String body = con.readStringByLength(contentLength);
    Assert.assertTrue(header.indexOf("200") != -1);
    Assert.assertEquals("isSecured=true", body);
   
    con.close();
    server.close();
View Full Code Here

    con.write(request.toString());
     
    String header = con.readStringByDelimiter("\r\n\r\n") + "\r\n";
    int contentLength = QAUtil.readContentLength(header);
   
    String msg = con.readStringByLength(contentLength);
   
    Assert.assertTrue(header.indexOf("400") != -1);


   
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.