Package org.xsocket.connection

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


   

    IBlockingConnection con = new BlockingConnection("localhost", server.getLocalPort());
    con.write("GET /\n");
   
    String header = con.readStringByDelimiter("\r\n\r\n") + "\r\n";
    int contentLength = QAUtil.readContentLength(header);
    String body = con.readStringByLength(contentLength);
   
    Assert.assertTrue(header.indexOf("400") != -1);
    Assert.assertTrue(body.indexOf("simple request messages are not supported") != -1);
View Full Code Here


    con.write("GET    /    HTTP/1.1\r\n" +
          "Host: localhost\r\n" +
          "User-Agent: me\r\n" +
          "\r\n");
   
    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("OK", body);
View Full Code Here

    con.write("GET    /  \t  HTTP/1.1\r\n" +
          "Host: localhost\r\n" +
          "User-Agent: me\r\n" +
          "\r\n");
   
    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("OK", body);
View Full Code Here

          "Host: localhost\r\n" +
          "User-Agent: me\r\n" +
          "\r\n" +
          "12345");
   
    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("OK", body);
View Full Code Here

          "GET / HTTP/1.1\r\n" +
          "Host: localhost\r\n" +
          "User-Agent: me\r\n" +
          "\r\n");
   
    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("OK", body);
View Full Code Here

          "GET / HTTP/1.1\r\n" +
          "Host: localhost\r\n" +
          "User-Agent: me\r\n" +
          "\r\n");
   
    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("OK", body);
View Full Code Here

          "GET / HTTP/1.1\r\n" +
          "Host: localhost\r\n" +
          "User-Agent: me\r\n" +
          "\r\n");
   
    String header = con.readStringByDelimiter("\r\n\r\n") + "\r\n";
    int contentLength = QAUtil.readContentLength(header);
    String body = con.readStringByLength(contentLength);
   
    Assert.assertTrue(header.indexOf("400") != -1);
    Assert.assertTrue(body.indexOf("bad request") != -1);
View Full Code Here

          "Cookie: pA_c[p]=rZNBCsIwEEXvkhNkZpIa05VgFx5ANyJStWpRbKGgC9u7m1qo;\r\n" +
          " pA_c[p340358058568d1f]=S7QysqoutjIytF;\r\n" +
          " pA_c[p3403580662066ea]=S7QysqoutjIytFIqyChwTC;\r\n" +
          "\r\n");
   
    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("OK", body);
View Full Code Here

          "User-Agent: me\r\n" +
          "\r\n");


   
    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("OK", body);
View Full Code Here

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


    header = con.readStringByDelimiter("\r\n\r\n") + "\r\n";
    contentLength = QAUtil.readContentLength(header);
    body = con.readStringByLength(contentLength);
   
    Assert.assertTrue(header.indexOf("200") != -1);
    Assert.assertEquals("OK", body);
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.