com.taobao.weex.adapter.DefaultWXHttpAdapter Java Examples

The following examples show how to use com.taobao.weex.adapter.DefaultWXHttpAdapter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WXStreamModuleTest.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
@Test
public void testFetchRequestHttpbinCallback() throws Exception{
  WXStreamModule streamModule = createModule(new DefaultWXHttpAdapter());
  JSCallback progress = mock(JSCallback.class);
  JSCallback finish = mock(JSCallback.class);
  System.out.print("request start "+System.currentTimeMillis());
  streamModule.fetch("{method: 'POST',url: 'http://httpbin.org/post',type:'json'}",finish,progress);
  verify(progress,timeout(10*1000).atLeastOnce()).invokeAndKeepAlive(anyMapOf(String.class, Object.class));
  verify(finish,timeout(10*1000).times(1)).invoke(anyMapOf(String.class, Object.class));
  System.out.print("\nrequest finish"+System.currentTimeMillis());
}
 
Example #2
Source File: WXStreamModuleTest.java    From weex-uikit with MIT License 5 votes vote down vote up
@Test
public void testFetchRequestHttpbinCallback() throws Exception{
  WXStreamModule streamModule = createModule(new DefaultWXHttpAdapter());
  JSCallback progress = mock(JSCallback.class);
  JSCallback finish = mock(JSCallback.class);
  System.out.print("request start "+System.currentTimeMillis());
  streamModule.fetch("{method: 'POST',url: 'http://httpbin.org/post',type:'json'}",finish,progress);
  verify(progress,timeout(10*1000).atLeastOnce()).invokeAndKeepAlive(anyMapOf(String.class, Object.class));
  verify(finish,timeout(10*1000).times(1)).invoke(anyMapOf(String.class, Object.class));
  System.out.print("\nrequest finish"+System.currentTimeMillis());
}
 
Example #3
Source File: WXStreamModuleTest.java    From weex with Apache License 2.0 5 votes vote down vote up
@Test
public void testFetchRequestHttpbinCallback() throws Exception{
  WXStreamModule streamModule = new WXStreamModule(new DefaultWXHttpAdapter());
  JSCallback progress = mock(JSCallback.class);
  JSCallback finish = mock(JSCallback.class);
  System.out.print("request start "+System.currentTimeMillis());
  streamModule.fetch("{method: 'POST',url: 'http://httpbin.org/post',type:'json'}",finish,progress);
  verify(progress,timeout(10*1000).atLeastOnce()).invokeAndKeepAlive(anyMapOf(String.class, Object.class));
  verify(finish,timeout(10*1000).times(1)).invoke(anyMapOf(String.class, Object.class));
  System.out.print("\nrequest finish"+System.currentTimeMillis());
}