Package org.xsocket.connection

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


        con.write("GET /picture/?blablabla&werwer 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 / 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

                  "Content-Length: 5\r\n" +
                  "Content-Type: text/plain;charset=iso-8859-1\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

                  "Content-Length: 5\r\n" +
                  "Content-Type: text/plain;charset=\"iso-8859-1\"\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

    IBlockingConnection con = new BlockingConnection("localhost", server.getLocalPort());
    con.write("GET / HTTP/1.0\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

    IBlockingConnection con = new BlockingConnection("localhost", server.getLocalPort());
    con.write("GET / HTTP/1.0\n" +
          "\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

    IBlockingConnection con = new BlockingConnection("localhost", server.getLocalPort());
    con.write("GET /s/ ere6r" + "\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 message") != -1);
View Full Code Here

   

    IBlockingConnection con = new BlockingConnection("localhost", server.getLocalPort());
    con.write("GET /\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("simple request messages are not supported") != -1);
View Full Code Here

   

    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

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.