Package org.jboss.remoting.transport.multiplex.utility

Examples of org.jboss.remoting.transport.multiplex.utility.GrowablePipedInputStream


   {
      log.info("entering: testConstructors()");
     
      try
      {
         GrowablePipedInputStream gpis1 = new GrowablePipedInputStream();
         GrowablePipedOutputStream gpos1 = new GrowablePipedOutputStream(gpis1);
         GrowablePipedInputStream gpis2 = new GrowablePipedInputStream();
         GrowablePipedOutputStream gpos2 = new GrowablePipedOutputStream(gpis2);
         GrowablePipedInputStream gpis3 = new GrowablePipedInputStream();
         GrowablePipedOutputStream gpos3 = new GrowablePipedOutputStream();
        
         try
         {
            gpis3.read();
            fail();
         }
         catch (Exception e)
         {
            assertTrue(e.getMessage().equals("Pipe not connected"));
View Full Code Here


   {
      log.info("entering: testAvailable()");
     
      try
      {
         GrowablePipedInputStream  gpis = new GrowablePipedInputStream();
         GrowablePipedOutputStream gpos = new GrowablePipedOutputStream(gpis);
         int size = 64 * 1024;
        
         for (int i = 0; i < size; i++)
            gpos.write(i);
        
         assertTrue(gpis.available() == size);
        
      }
      catch (Exception e)
      {
         log.error(e);
View Full Code Here

   {
      log.info("entering: testIO()");
     
      try
      {
         final GrowablePipedInputStream gpis = new GrowablePipedInputStream();
         final GrowablePipedOutputStream gpos = new GrowablePipedOutputStream(gpis);
         final int size =  128 * 1024;
         final byte[] bytesIn = new byte[size];
         final byte[] bytesOut = new byte[size];
        
         for (int i = 0; i < size; i++)
         {
            bytesIn[i] = (byte) i;
         }
        
         class ThreadOut extends Thread
         {
            Exception e;
            public void run()
            {
               try
               {
                  for (int i = 0; i < size / 2; i++)
                     gpos.write(bytesIn[i]);
                 
                  int chunk = 4096;
                 
                  for (int i = size / 2; i < size; )
                  {
                     gpos.write(bytesIn, i, chunk);
                     i += chunk;
                  }
               }
               catch (IOException e)
               {
                  this.e = e;
               }
            }
            public Exception getException()
            {
               return e;
            }
         };
        
         class ThreadIn extends Thread
         {
            Exception e;
            public void run()
            {
               try
               {
                  for (int i = 0; i < size; i++)
                     bytesOut[i] = (byte) gpis.read();
               }
               catch (IOException e)
               {
                  this.e = e;
               }
View Full Code Here

      log.info("entering: testVirtualSelector()");
     
      try
      {
         final VirtualSelector vs = new VirtualSelector();
         final GrowablePipedInputStream  gpis1 = new GrowablePipedInputStream(vs);
         final GrowablePipedOutputStream gpos1 = new GrowablePipedOutputStream(gpis1);
         final GrowablePipedInputStream  gpis2 = new GrowablePipedInputStream(vs);
         final GrowablePipedOutputStream gpos2 = new GrowablePipedOutputStream(gpis2);
         final int size =  128 * 1024;
         final byte[] bytesOut1 = new byte[size];
         final byte[] bytesOut2 = new byte[size];
         final ShrinkableByteArrayOutputStream bytesIn1  = new ShrinkableByteArrayOutputStream();
View Full Code Here

   {
      log.info("entering: testConstructors()");
     
      try
      {
         GrowablePipedInputStream gpis1 = new GrowablePipedInputStream();
         GrowablePipedOutputStream gpos1 = new GrowablePipedOutputStream(gpis1);
         GrowablePipedInputStream gpis2 = new GrowablePipedInputStream();
         GrowablePipedOutputStream gpos2 = new GrowablePipedOutputStream(gpis2);
         GrowablePipedInputStream gpis3 = new GrowablePipedInputStream();
         GrowablePipedOutputStream gpos3 = new GrowablePipedOutputStream();
        
         try
         {
            gpis3.read();
            fail();
         }
         catch (Exception e)
         {
            assertTrue(e.getMessage().equals("Pipe not connected"));
View Full Code Here

   {
      log.info("entering: testAvailable()");
     
      try
      {
         GrowablePipedInputStream  gpis = new GrowablePipedInputStream();
         GrowablePipedOutputStream gpos = new GrowablePipedOutputStream(gpis);
         int size = 64 * 1024;
        
         for (int i = 0; i < size; i++)
            gpos.write(i);
        
         assertTrue(gpis.available() == size);
        
      }
      catch (Exception e)
      {
         log.error(e);
View Full Code Here

   {
      log.info("entering: testIO()");
     
      try
      {
         final GrowablePipedInputStream gpis = new GrowablePipedInputStream();
         final GrowablePipedOutputStream gpos = new GrowablePipedOutputStream(gpis);
         final int size =  128 * 1024;
         final byte[] bytesIn = new byte[size];
         final byte[] bytesOut = new byte[size];
        
         for (int i = 0; i < size; i++)
         {
            bytesIn[i] = (byte) i;
         }
        
         class ThreadOut extends Thread
         {
            Exception e;
            public void run()
            {
               try
               {
                  for (int i = 0; i < size / 2; i++)
                     gpos.write(bytesIn[i]);
                 
                  int chunk = 4096;
                 
                  for (int i = size / 2; i < size; )
                  {
                     gpos.write(bytesIn, i, chunk);
                     i += chunk;
                  }
               }
               catch (IOException e)
               {
                  this.e = e;
               }
            }
            public Exception getException()
            {
               return e;
            }
         };
        
         class ThreadIn extends Thread
         {
            Exception e;
            public void run()
            {
               try
               {
                  for (int i = 0; i < size; i++)
                     bytesOut[i] = (byte) gpis.read();
               }
               catch (IOException e)
               {
                  this.e = e;
               }
View Full Code Here

      log.info("entering: testVirtualSelector()");
     
      try
      {
         final VirtualSelector vs = new VirtualSelector();
         final GrowablePipedInputStream  gpis1 = new GrowablePipedInputStream(vs);
         final GrowablePipedOutputStream gpos1 = new GrowablePipedOutputStream(gpis1);
         final GrowablePipedInputStream  gpis2 = new GrowablePipedInputStream(vs);
         final GrowablePipedOutputStream gpos2 = new GrowablePipedOutputStream(gpis2);
         final int size =  128 * 1024;
         final byte[] bytesOut1 = new byte[size];
         final byte[] bytesOut2 = new byte[size];
         final ShrinkableByteArrayOutputStream bytesIn1  = new ShrinkableByteArrayOutputStream();
View Full Code Here

TOP

Related Classes of org.jboss.remoting.transport.multiplex.utility.GrowablePipedInputStream

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.