Package org.simpleframework.util.buffer

Examples of org.simpleframework.util.buffer.Allocator


   "--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


   }
  
   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

   }
  
   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

      MockRenegotiationServer server = new MockRenegotiationServer(sslContext, false, 10001);     
      server.start();
   }

   public MockRenegotiationServer(SSLContext context, boolean certRequired, int port) throws IOException {
      Allocator allocator = new FileAllocator();
      ContainerProcessor processor = new ContainerProcessor(this, allocator, 4);
      TransportGrabber grabber = new TransportGrabber(processor);
      ProcessorServer processorServer = new ProcessorServer(grabber);
     
      this.server = new ConfigurableCertificateServer(processorServer, certRequired)
View Full Code Here

      private final Connection connection;
      private final SocketAddress address;
      private final String message;
     
      public PingServer(int port, String message) throws Exception {
         Allocator allocator = new FileAllocator();
         Processor processor  = new ContainerProcessor(this, allocator, 5);
         Server server = new ProcessorServer(processor);
         DebugServer debug = new DebugServer(server);
        
         this.connection = new SocketConnection(debug);
View Full Code Here

import org.simpleframework.util.buffer.ArrayAllocator;

public class TokenConsumerTest extends TestCase {
  
   public void testTokenConsumer() throws IOException {
      Allocator allocator = new ArrayAllocator();
      TokenConsumer consumer = new TokenConsumer(allocator, "\r\n".getBytes());
      Cursor cursor = new StreamCursor("\r\n");
     
      consumer.consume(cursor);
     
View Full Code Here

      assertEquals(cursor.ready(), -1);
      assertTrue(consumer.isFinished())
   }
  
   public void testTokenConsumerException() throws IOException {
      Allocator allocator = new ArrayAllocator();
      TokenConsumer consumer = new TokenConsumer(allocator, "\r\n".getBytes());
      Cursor cursor = new StreamCursor("--\r\n");
      boolean exception = false;
     
      try {
View Full Code Here

      }
      assertTrue("Exception not thrown for invalid token", exception);
   }
  
   public void testTokenConsumerDribble() throws IOException {
      Allocator allocator = new ArrayAllocator();
      TokenConsumer consumer = new TokenConsumer(allocator, "This is a large token to be consumed\r\n".getBytes());
      DribbleCursor cursor = new DribbleCursor(new StreamCursor("This is a large token to be consumed\r\n0123456789"), 1);

      consumer.consume(cursor);
     
View Full Code Here

import org.simpleframework.util.buffer.ArrayAllocator;

public class TokenConsumerTest extends TestCase {
  
   public void testTokenConsumer() throws IOException {
      Allocator allocator = new ArrayAllocator();
      TokenConsumer consumer = new TokenConsumer(allocator, "\r\n".getBytes());
      Cursor cursor = new StreamCursor("\r\n");
     
      consumer.consume(cursor);
     
View Full Code Here

      assertEquals(cursor.ready(), -1);
      assertTrue(consumer.isFinished())
   }
  
   public void testTokenConsumerException() throws IOException {
      Allocator allocator = new ArrayAllocator();
      TokenConsumer consumer = new TokenConsumer(allocator, "\r\n".getBytes());
      Cursor cursor = new StreamCursor("--\r\n");
      boolean exception = false;
     
      try {
View Full Code Here

TOP

Related Classes of org.simpleframework.util.buffer.Allocator

Copyright © 2018 www.massapicom. 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.