Examples of ArrayAllocator


Examples of org.simpleframework.util.buffer.ArrayAllocator

   "--mxvercagiykxaqsdvrfabfhfpaseejrg--";        
  
   public void testNoFinalCRLF() throws Exception {
      byte[] data = SOURCE.getBytes("UTF-8");
      byte[] boundary = "mxvercagiykxaqsdvrfabfhfpaseejrg".getBytes("UTF-8");
      Allocator allocator = new ArrayAllocator();
      FileUploadConsumer consumer = new FileUploadConsumer(allocator, boundary, data.length);     
      Cursor cursor = new StreamCursor(data);
     
      while(!consumer.isFinished()) {
         consumer.consume(cursor);
View Full Code Here

Examples of org.simpleframework.util.buffer.ArrayAllocator

   }
  
   public void testNoFinalCRLSWithDribble() throws Exception {
      byte[] data = SOURCE.getBytes("UTF-8");
      byte[] boundary = "mxvercagiykxaqsdvrfabfhfpaseejrg".getBytes("UTF-8");
      Allocator allocator = new ArrayAllocator();
      FileUploadConsumer consumer = new FileUploadConsumer(allocator, boundary, data.length);     
      Cursor cursor = new StreamCursor(data);
      DribbleCursor dribble = new DribbleCursor(cursor, 1);
     
      while(!consumer.isFinished()) {
View Full Code Here

Examples of org.simpleframework.util.buffer.ArrayAllocator

   }
  
   public void testNoFinalCRLSWithDribble3() throws Exception {
      byte[] data = SOURCE.getBytes("UTF-8");
      byte[] boundary = "mxvercagiykxaqsdvrfabfhfpaseejrg".getBytes("UTF-8");
      Allocator allocator = new ArrayAllocator();
      FileUploadConsumer consumer = new FileUploadConsumer(allocator, boundary, data.length);     
      Cursor cursor = new StreamCursor(data);
      DribbleCursor dribble = new DribbleCursor(cursor, 3);
     
      while(!consumer.isFinished()) {
View Full Code Here

Examples of org.simpleframework.util.buffer.ArrayAllocator

   private static final byte[] BOUNDARY = { 'A', 'a', 'B', '0', '3', 'x' };
  
   private BoundaryConsumer boundary;
  
   public void setUp() {
      boundary = new BoundaryConsumer(new ArrayAllocator(), BOUNDARY);
   }
View Full Code Here

Examples of org.simpleframework.util.buffer.ArrayAllocator

   "... contents of file1.txt ...\r\n"+
   "--AaB03x\r\n";
  
   public void testHeader() throws Exception {
      PartData list = new PartData();
      PartConsumer consumer = new PartConsumer(new ArrayAllocator(), list, "AaB03x".getBytes("UTF-8"), 8192);
      Cursor cursor = new StreamCursor(SOURCE);
     
      while(!consumer.isFinished()) {
         consumer.consume(cursor);
      }  
View Full Code Here

Examples of org.simpleframework.util.buffer.ArrayAllocator

            buf.append("\n");          
            line = 0;
         }

      }
      buffer = new ArrayAllocator().allocate();
     
      String requestBody = buf.toString();
      FixedConsumer consumer = new FixedConsumer(this, limitSize);
      Cursor cursor = new DribbleCursor(new StreamCursor(requestBody), dribble);
      byte[] requestBytes = requestBody.getBytes("UTF-8");
View Full Code Here

Examples of org.simpleframework.util.buffer.ArrayAllocator

   private ConcurrentHashMap<String, StopWatch> timers = new ConcurrentHashMap<String, StopWatch>();
  
   private LinkedBlockingQueue<StopWatch> finished = new LinkedBlockingQueue<StopWatch>();
  
   public void testMinimal() throws Exception {
      Initiator handler = new ContainerSelector(this, new ArrayAllocator(), 10, 2);
           
      testRequest(handler, "/MINIMAL/%s", MINIMAL, "MINIMAL");
      testRequest(handler, "/SIMPLE/%s", SIMPLE, "SIMPLE");
      testRequest(handler, "/UPLOAD/%s", UPLOAD, "UPLOAD");
   }
View Full Code Here

Examples of org.simpleframework.util.buffer.ArrayAllocator

      if(dribble < PAYLOAD.length) {
         cursor = new DribbleCursor(cursor, dribble);
      }
      Channel channel = new MockChannel(cursor);
      MockSelector selector = new MockSelector();
      Collector body = new Collector(new ArrayAllocator(), channel);
     
      while(!selector.isReady()) {
         body.collect(selector);
      }  
      Request request = new RequestEntity(body, null);
View Full Code Here

Examples of org.simpleframework.util.buffer.ArrayAllocator

     
      assertEquals(cursor.ready(), -1);
   }
  
   public void start(Channel channel) throws IOException {  
      start(new Collector(new ArrayAllocator(), channel));
   }
View Full Code Here

Examples of org.simpleframework.util.buffer.ArrayAllocator

   }
  
   public void testChunk(int chunkSize, int count) throws Exception {
      MockSender sender = new MockSender((chunkSize * count) + 1024);
      MockMonitor monitor = new MockMonitor();
      ChunkedConsumer validator = new ChunkedConsumer(new ArrayAllocator());
      ChunkedProducer producer = new ChunkedProducer(sender, monitor);
      byte[] chunk = new byte[chunkSize];
     
      for(int i = 0; i < chunk.length; i++) {
         chunk[i] = (byte)String.valueOf(i).charAt(0);
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.