Package org.xsocket.connection

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


          "Host: localhost\r\n" +
          "User-Agent: me\r\n" +
          "Connection: Keep-Alive\r\n" +
          "\r\n");
     
    String header = con.readStringByDelimiter("\r\n\r\n") + "\r\n";
    int contentLength = QAUtil.readContentLength(header);
    con.readStringByLength(contentLength);
   
    Assert.assertTrue(header.indexOf("HTTP/1.0") != -1);
    Assert.assertTrue(header.indexOf("Connection: close") != -1)// xSocket will ignore keep-alive if HTTP/1.0
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

    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 /test HTTP/1.1\r\n" +
              "Host: localhost:" + server.getLocalPort() + "\r\n" +
              "User-Agent: me\r\n\r\n");
   
    String header = con.readStringByDelimiter("\r\n\r\n");
    Assert.assertTrue(header.indexOf("200") != -1);
    Assert.assertFalse(h1.isForwardedRef.get());
   
    h1.reset();
    h2.reset();
View Full Code Here

    con = new BlockingConnection("localhost", server.getLocalPort());
    con.write("GET /bs HTTP/1.1\r\n" +
                "Host: localhost:" + server.getLocalPort() + "\r\n" +
                "User-Agent: me\r\n\r\n");
     
    header = con.readStringByDelimiter("\r\n\r\n");
    Assert.assertTrue(header.indexOf("200") != -1);
    Assert.assertTrue(h1.isForwardedRef.get());
      Assert.assertFalse(h2.isForwardedRef.get());
     
        con.close();
View Full Code Here

        con = new BlockingConnection("localhost", server.getLocalPort());
        con.write("GET /bs HTTP/1.1\r\n" +
                "Host: localhost:" + server.getLocalPort() + "\r\n" +
                "User-Agent: me\r\n\r\n");
     
        String header = con.readStringByDelimiter("\r\n\r\n");
        Assert.assertTrue(header.indexOf("200") != -1);
        Assert.assertTrue(h1.isForwardedRef.get());
        Assert.assertFalse(h2.isForwardedRef.get());
       
        h1.reset();
View Full Code Here

        con = new BlockingConnection("localhost", server.getLocalPort());
        con.write("GET /tztz HTTP/1.1\r\n" +
                "Host: localhost:" + server.getLocalPort() + "\r\n" +
                "User-Agent: me\r\n\r\n");
     
        String header = con.readStringByDelimiter("\r\n\r\n");
        Assert.assertTrue(header.indexOf("404") != -1);
        Assert.assertTrue(h1.isForwardedRef.get());
        Assert.assertTrue(h2.isForwardedRef.get());
       
        con.close();
View Full Code Here

       
        con.write("GET /test HTTP/1.1\r\n" +
                  "Host: localhost:" + server.getLocalPort() + "\r\n" +
                  "User-Agent: me\r\n\r\n");
       
        String header = con.readStringByDelimiter("\r\n\r\n");
        Assert.assertTrue(header.indexOf("200") != -1);
       
        con.close();
        server.close();
    }
View Full Code Here

                  "User-Agent: me\r\n" +
                  "Content-Length: 5\r\n" +
                  "\r\n" +
                  "12345");
       
        String header = con.readStringByDelimiter("\r\n\r\n");
        Assert.assertTrue(header.indexOf("200") != -1);
       
        QAUtil.sleep(1000);
        Assert.assertEquals("addedLine\r\n12345", con.readStringByLength(16));
       
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.