Package org.xsocket.connection

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


          "Content-Length: 4\r\n" +
          "\r\n" +
          "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


          "Content-Length: 4\r\n" +
          "\r\n" +
          "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

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

    IBlockingConnection con = new BlockingConnection("localhost", server.getLocalPort());
    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();
View Full Code Here

                 "Upgrade: WebSocket\r\n"+
                 "Connection: Upgrade\r\n"+
                 "Origin: http://localhost:5161/\r\n"+
                 "\r\n");

        bc.readStringByDelimiter("\r\n\r\n");

       
        byte[] msg1 = bc.readBytesByLength(11);
        Assert.assertArrayEquals(new byte[] { 0x00, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x79, 0x6f, 0x75, (byte) 0xFF}, msg1);
View Full Code Here

                 "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"));
       
       
        byte[] msg1 = bc.readBytesByLength(11);
        Assert.assertArrayEquals(new byte[] { 0x00, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x79, 0x6f, 0x75, (byte) 0xFF}, msg1);
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);
     
      con.readByteBufferByLength(contentLength);

      if (i == 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);
     
      con.readByteBufferByLength(contentLength);

      if (i == 1) {
View Full Code Here

          "Host: localhost\r\n" +
          "User-Agent: me\r\n" +
          "Connection: close\r\n" +
          "\r\n");
     
    String header = con.readStringByDelimiter("\r\n\r\n") + "\r\n";
    int contentLength = QAUtil.readContentLength(header);
     
    con.readByteBufferByLength(contentLength);
   
    Assert.assertTrue(header.indexOf("Connection: close") != -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);
     
      con.readByteBufferByLength(contentLength);

      Assert.assertTrue(header.indexOf("200") != -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.