Want more features on Pastebin? Sign Up, it's FREE!
Guest

ALR

By: a guest on Apr 14th, 2011  |  syntax: Java  |  size: 0.79 KB  |  views: 75  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. @Test
  2.    public void testArrays() throws Exception
  3.    {
  4.  
  5.       ShrinkWrap.create(JavaArchive.class, "test.jar").add(MegaByteAsset.newInstance(), "dummy").as(ZipExporter.class)
  6.             .exportAsInputStream();
  7.       // I want the pipe full
  8.       Thread.sleep(1000);
  9.       for (int i = 0; i < 3; i++)
  10.       {
  11.          System.gc();
  12.          Runtime.getRuntime().runFinalization();
  13.       }
  14.       final InputStream in = ShrinkWrap.create(JavaArchive.class, "test.jar").add(MegaByteAsset.newInstance(), "dummy")
  15.             .as(ZipExporter.class).exportAsInputStream();
  16.      
  17.       final OutputStream out = new OutputStream()
  18.       {
  19.          
  20.          @Override
  21.          public void write(int b) throws IOException
  22.          {
  23.            // NOOP
  24.          }
  25.       };
  26.      
  27.       IOUtil.copyWithClose(in, out);
  28.    }
clone this paste RAW Paste Data