Package org.simpleframework.http.core

Examples of org.simpleframework.http.core.Conversation


   public void testTransferEncoding() throws IOException {
      MockChannel channel = new MockChannel(null);
      MockMonitor monitor = new MockMonitor();
      MockRequest request = new MockRequest();
      MockResponse response = new MockResponse();
      Conversation support = new Conversation(request, response);
      Transfer transfer = new Transfer(response, support, channel, monitor);
     
      // Start a HTTP/1.1 conversation
      request.setMajor(1);
      request.setMinor(1);
      transfer.start();
     
      assertEquals(response.getValue("Connection"), "keep-alive");
      assertEquals(response.getValue("Transfer-Encoding"), "chunked");
      assertEquals(response.getValue("Content-Length"), null);
      assertEquals(response.getContentLength(), -1);
      assertTrue(response.isCommitted());
     
      channel = new MockChannel(null);
      monitor = new MockMonitor();
      request = new MockRequest();
      response = new MockResponse();
      support = new Conversation(request, response);
      transfer = new Transfer(response, support, channel, monitor);
     
      // Start a HTTP/1.0 conversation
      request.setMajor(1);
      request.setMinor(0);
View Full Code Here


   public void testContentLength() throws IOException {
      MockChannel channel = new MockChannel(null);
      MockMonitor monitor = new MockMonitor();
      MockRequest request = new MockRequest();
      MockResponse response = new MockResponse();
      Conversation support = new Conversation(request, response);
      Transfer transfer = new Transfer(response, support, channel, monitor);
     
      // Start a HTTP/1.1 conversation
      request.setMajor(1);
      request.setMinor(1);
      transfer.start(1024);
     
      assertEquals(response.getValue("Connection"), "keep-alive");
      assertEquals(response.getValue("Content-Length"), "1024");
      assertEquals(response.getValue("Transfer-Encoding"), null);
      assertEquals(response.getContentLength(), 1024);
      assertTrue(response.isCommitted());
     
      channel = new MockChannel(null);
      monitor = new MockMonitor();
      request = new MockRequest();
      response = new MockResponse();
      support = new Conversation(request, response);
      transfer = new Transfer(response, support, channel, monitor);
     
      // Start a HTTP/1.0 conversation
      request.setMajor(1);
      request.setMinor(0);
      transfer.start(1024);
     
      assertEquals(response.getValue("Connection"), "close");
      assertEquals(response.getValue("Content-Length"), "1024");
      assertEquals(response.getValue("Transfer-Encoding"), null);
      assertEquals(response.getContentLength(), 1024);
      assertTrue(response.isCommitted());
     
      channel = new MockChannel(null);
      monitor = new MockMonitor();
      request = new MockRequest();
      response = new MockResponse();
      support = new Conversation(request, response);
      transfer = new Transfer(response, support, channel, monitor);
     
      // Start a HTTP/1.0 conversation
      request.setMajor(1);
      request.setMinor(1);
View Full Code Here

   public void  testHeadMethodWithConnectionClose() throws IOException {
      MockChannel channel = new MockChannel(null);
      MockMonitor monitor = new MockMonitor();
      MockRequest request = new MockRequest();
      MockResponse response = new MockResponse();
      Conversation support = new Conversation(request, response);
      Transfer transfer = new Transfer(response, support, channel, monitor);

      request.setMajor(1);
      request.setMinor(0);
      request.setMethod("HEAD");
View Full Code Here

   public void  testHeadMethodWithSomethingWritten() throws IOException {
      MockChannel channel = new MockChannel(null);
      MockMonitor monitor = new MockMonitor();
      MockRequest request = new MockRequest();
      MockResponse response = new MockResponse();
      Conversation support = new Conversation(request, response);
      Transfer transfer = new Transfer(response, support, channel, monitor);

      request.setMajor(1);
      request.setMinor(1);
      request.setMethod("HEAD");
View Full Code Here

   public void testHeadMethodWithNoContentLength() throws IOException {
      MockChannel channel = new MockChannel(null);
      MockMonitor monitor = new MockMonitor();
      MockRequest request = new MockRequest();
      MockResponse response = new MockResponse();
      Conversation support = new Conversation(request, response);
      Transfer transfer = new Transfer(response, support, channel, monitor);

      request.setMajor(1);
      request.setMinor(1);
      request.setMethod("HEAD");
View Full Code Here

   public void testHeadMethodWithNoContentLengthAndSomethingWritten() throws IOException {
      MockChannel channel = new MockChannel(null);
      MockMonitor monitor = new MockMonitor();
      MockRequest request = new MockRequest();
      MockResponse response = new MockResponse();
      Conversation support = new Conversation(request, response);
      Transfer transfer = new Transfer(response, support, channel, monitor);

      request.setMajor(1);
      request.setMinor(1);
      request.setMethod("HEAD");
View Full Code Here

   private Conversation support;
  
   public void setUp() {
      request = new MockRequest();
      response = new MockResponse();
      support = new Conversation(request, response);
   }
View Full Code Here

   public void testAccumulator() throws IOException {
      MockSender sender = new MockSender();
      MockMonitor monitor = new MockMonitor();
      MockRequest request = new MockRequest();
      MockResponse response = new MockResponse();
      Conversation support = new Conversation(request, response);
      Accumulator buffer = new Accumulator(support, sender, monitor);
     
      byte[] content = { 'T', 'E', 'S', 'T' };
     
      // Start a HTTP/1.1 conversation
      request.setMajor(1);
      request.setMinor(1);
     
      // Write to a zero capacity buffer
      buffer.expand(0);
      buffer.write(content, 0, content.length);
     
      assertEquals(response.getValue("Connection"), "keep-alive");
      assertEquals(response.getValue("Transfer-Encoding"), "chunked");
      assertEquals(response.getValue("Content-Length"), null);
      assertEquals(response.getContentLength(), -1);
      assertTrue(response.isCommitted());
     
      sender = new MockSender();
      monitor = new MockMonitor();
      request = new MockRequest();
      response = new MockResponse();
      support = new Conversation(request, response);
      buffer = new Accumulator(support, sender, monitor);
     
      // Start a HTTP/1.0 conversation
      request.setMajor(1);
      request.setMinor(0);
     
      // Write to a zero capacity buffer
      buffer.expand(0);
      buffer.write(content, 0, content.length);
     
      assertEquals(response.getValue("Connection"), "close");
      assertEquals(response.getValue("Transfer-Encoding"), null);
      assertEquals(response.getValue("Content-Length"), null);
      assertEquals(response.getContentLength(), -1);
      assertTrue(response.isCommitted());
     
      sender = new MockSender();
      monitor = new MockMonitor();
      request = new MockRequest();
      response = new MockResponse();
      support = new Conversation(request, response);
      buffer = new Accumulator(support, sender, monitor);
     
      // Start a HTTP/1.1 conversation
      request.setMajor(1);
      request.setMinor(1);
View Full Code Here

   private Conversation support;
  
   public void setUp() {
      request = new MockRequest();
      response = new MockResponse();
      support = new Conversation(request, response);
   }
View Full Code Here

   public void  testHeadMethodWithSomethingWritten() throws IOException {
      MockSender sender = new MockSender();
      MockMonitor monitor = new MockMonitor();
      MockRequest request = new MockRequest();
      MockResponse response = new MockResponse();
      Conversation support = new Conversation(request, response);
      Transfer transfer = new Transfer(support, sender, monitor);

      request.setMajor(1);
      request.setMinor(1);
      request.setMethod("HEAD");
View Full Code Here

TOP

Related Classes of org.simpleframework.http.core.Conversation

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.