Package org.simpleframework.transport

Examples of org.simpleframework.transport.Cursor.ready()


      Cursor cursor = new StreamCursor(SOURCE);
     
      while(!header.isFinished()) {
         header.consume(cursor);
      }     
      assertEquals(cursor.ready(), -1);
      assertEquals(header.getValue("Pragma"), null);
      assertEquals(header.getValue("User-Agent"), "");
      assertEquals(header.getValue("Content-Length"), "42");
      assertEquals(header.getValue("Content-Type"), "application/x-www-form-urlencoded");
      assertEquals(header.getValue("Host"), "some.host.com");
View Full Code Here


      Cursor cursor = new StreamCursor(EMPTY);
     
      while(!header.isFinished()) {
         header.consume(cursor);
      }     
      assertEquals(cursor.ready(), -1);
      assertEquals(header.getValue("Accept-Language"), "");
      assertEquals(header.getValue("Content-Length"), "");
      assertEquals(header.getValue("Content-Type"), "");
      assertEquals(header.getValue("Content-Disposition"), "");
      assertEquals(header.getValue("Transfer-Encoding"), "");
View Full Code Here

      Cursor cursor = new DribbleCursor(new StreamCursor(SOURCE), 1);
     
      while(!header.isFinished()) {
         header.consume(cursor);
      }     
      assertEquals(cursor.ready(), -1);
      assertEquals(header.getValue("Content-Length"), "42");
      assertEquals(header.getValue("Content-Type"), "application/x-www-form-urlencoded");
      assertEquals(header.getValue("Host"), "some.host.com");
      assertEquals(header.getValues("Accept").size(), 4);
      assertEquals(header.getValues("Accept").get(0), "image/gif");
View Full Code Here

     
         while(!header.isFinished()) {
            header.consume(cursor);
         }
        
         assertEquals(cursor.ready(), -1);
         assertEquals(header.getPath().getPath(), path);    
      }
      System.err.printf("%s time=%s%n", path, (System.currentTimeMillis() - start));
   }
  
View Full Code Here

     
         while(!header.isFinished()) {
            header.consume(cursor);
         }
        
         assertEquals(cursor.ready(), -1);
         assertEquals(header.getTarget(), "/index.html");
         assertEquals(header.getMethod(), "POST");
         assertEquals(header.getMajor(), 1);
         assertEquals(header.getMinor(), 0);
         assertEquals(header.getValue("Content-Length"), "42");
View Full Code Here

      Cursor cursor = new DribbleCursor(new StreamCursor(SOURCE_1), 1);
     
      while(!header.isFinished()) {
         header.consume(cursor);
      }     
      assertEquals(cursor.ready(), -1);
      assertEquals(header.getTarget(), "/index.html");
      assertEquals(header.getMethod(), "POST");
      assertEquals(header.getMajor(), 1);
      assertEquals(header.getMinor(), 0);
      assertEquals(header.getValue("Content-Length"), "42");
View Full Code Here

      assertEquals(list.get(3).getName(), "file4");
      assertEquals(list.get(3).getFileName(), "file4.txt");
      assertEquals(list.get(3).isFile(), true);
      assertEquals(list.get(3).getContent(), "example contents of file4.txt ...");
      assertEquals(request.getPart("file4").getContent(), "example contents of file4.txt ...");
      assertEquals(cursor.ready(), -1);    
      assertEquals(request.getContent(), BODY);     
   }
}
View Full Code Here

      assertEquals(list.get(3).getContentType().getSecondary(), "plain");
      assertEquals(list.get(3).getHeader("Content-Disposition"), "file; name=\"pics\"; filename=\"file4.txt\"");
      assertEquals(list.get(3).getName(), "pics");
      assertEquals(list.get(3).getFileName(), "file4.txt");
      assertEquals(list.get(3).isFile(), true);
      assertEquals(cursor.ready(), -1);
   }

   public void stop() throws IOException {}   
}
View Full Code Here

      Cursor cursor = sender.getCursor();
     
      while(!validator.isFinished()) {
         validator.consume(cursor);
      }
      assertEquals(cursor.ready(), -1);
      assertTrue(monitor.isReady());
   }
}
View Full Code Here

      assertEquals(list.getParts().size(), 1);
      assertEquals(list.getParts().get(0).getContentType().getPrimary(), "text");
      assertEquals(list.getParts().get(0).getContentType().getSecondary(), "plain");
      assertEquals(list.getParts().get(0).getHeader("Content-Disposition"), "form-data; name='pics'; filename='file1.txt'");
      assertEquals(list.getParts().get(0).getContent(), "example contents of file1.txt ...");
      assertEquals(cursor.ready(), -1);    
      assertEquals(consumer.getBody().getContent(), SIMPLE);
   }
  
   public void testNormal() throws Exception {
      PartData list = new PartData();
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.