public Void call() throws Exception { HttpWire wire = setUp(); InputStream in = wire.input(fromServer); ByteArrayOutputStream out = new ByteArrayOutputStream();// TODO copy(in, out); byte[] compare = md5().hashBytes(out.toByteArray()).asBytes(); Thread.sleep(100); assertEquals(base16().lowerCase().encode(compare), checkNotNull(sysHttpStreamMd5, sysHttpStreamMd5)); assertEquals(((BufferLogger) wire.getWireLog()).buff.toString().getBytes().length, 3331484); return null; } }
@Test(groups = "live") public void testRemoteInputStreamSynch() throws Exception { try { URL url = new URL(checkNotNull(sysHttpStreamUrl, "sysHttpStreamUrl")); URLConnection connection = url.openConnection(); HttpWire wire = setUpSynch(); InputStream in = wire.input(connection.getInputStream()); byte[] compare = asByteSource(in).hash(md5()).asBytes(); Thread.sleep(100); assertEquals(base16().lowerCase().encode(compare), checkNotNull(sysHttpStreamMd5, sysHttpStreamMd5)); assertEquals(((BufferLogger) wire.getWireLog()).buff.toString().getBytes().length, 3331484); } catch (UnknownHostException e) { // probably in offline mode } }
@Test(groups = "live") public void testRemoteInputStreamSynch() throws Exception { try { URL url = new URL(checkNotNull(sysHttpStreamUrl, "sysHttpStreamUrl")); URLConnection connection = url.openConnection(); HttpWire wire = setUpSynch(); InputStream in = wire.input(connection.getInputStream()); byte[] compare = ByteStreams2.hashAndClose(in, md5()).asBytes(); Thread.sleep(100); assertEquals(base16().lowerCase().encode(compare), checkNotNull(sysHttpStreamMd5, sysHttpStreamMd5)); assertEquals(((BufferLogger) wire.getWireLog()).buff.toString().getBytes().length, 3331484); } catch (UnknownHostException e) { // probably in offline mode } }
public Void call() throws Exception { HttpWire wire = setUp(); InputStream in = wire.input(fromServer); byte[] compare = md5().hashBytes(ByteStreams.toByteArray(in)).asBytes(); Thread.sleep(100); assertEquals(base16().lowerCase().encode(compare), checkNotNull(sysHttpStreamMd5, sysHttpStreamMd5)); assertEquals(((BufferLogger) wire.getWireLog()).buff.toString().getBytes().length, 3331484); return null; } }
@Test(groups = "live") public void testRemoteInputStream() throws Exception { try { URL url = new URL(checkNotNull(sysHttpStreamUrl, "sysHttpStreamUrl")); URLConnection connection = url.openConnection(); HttpWire wire = setUp(); InputStream in = wire.input(connection.getInputStream()); byte[] compare = ByteStreams2.hashAndClose(in, md5()).asBytes(); Thread.sleep(100); assertEquals(base16().lowerCase().encode(compare), checkNotNull(sysHttpStreamMd5, sysHttpStreamMd5)); assertEquals(((BufferLogger) wire.getWireLog()).buff.toString().getBytes().length, 3331484); } catch (UnknownHostException e) { // probably in offline mode } }
@Test(groups = "live") public void testRemoteInputStream() throws Exception { try { URL url = new URL(checkNotNull(sysHttpStreamUrl, "sysHttpStreamUrl")); URLConnection connection = url.openConnection(); HttpWire wire = setUp(); InputStream in = wire.input(connection.getInputStream()); byte[] compare = asByteSource(in).hash(md5()).asBytes(); Thread.sleep(100); assertEquals(base16().lowerCase().encode(compare), checkNotNull(sysHttpStreamMd5, sysHttpStreamMd5)); assertEquals(((BufferLogger) wire.getWireLog()).buff.toString().getBytes().length, 3331484); } catch (UnknownHostException e) { // probably in offline mode } }