Skip to content

Instantly share code, notes, and snippets.

@Test(groups = "standalone", enabled = false)
public void basicDefaultTest() throws Throwable {
AsyncHttpClient c = new AsyncHttpClient();
final RandomAccessFile file = new RandomAccessFile("shrek1.avi", "rw");
Response r = c.prepareGet("http://192.168.2.106:8081/shrek1.AVI")
.setRangeHeaderValue(file.length())
.execute(new AsyncCompletionHandlerBase() {
/* @Override */
Downloading: https://repository.sonatype.org/content/groups/sonatype-grid/org/apache/maven/maven-parent/11/maven-parent-11.pom
Downloaded: https://repository.sonatype.org/content/groups/sonatype-grid/org/apache/maven/maven-parent/11/maven-parent-11.pom (32 KB at 14.8 KB/sec)
Exception in thread "pool-1-thread-2" java.lang.NoSuchMethodError: org.sonatype.aether.spi.io.FileProcessor.move(Ljava/io/File;Ljava/io/File;)V
at org.sonatype.aether.connector.async.AsyncRepositoryConnector$GetTask.rename(AsyncRepositoryConnector.java:799)
at org.sonatype.aether.connector.async.AsyncRepositoryConnector$GetTask.access$1400(AsyncRepositoryConnector.java:362)
at org.sonatype.aether.connector.async.AsyncRepositoryConnector$GetTask$1$1.run(AsyncRepositoryConnector.java:582)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:68
Builder b = new AsyncHttpClientConfig.Builder();
c.setExecutorServices(Executors.newFixedExecutorServices(10));
AsyncHttpClient c = new AsyncHttpClient(b.build());
Failed tests:
asyncDoGetKeepAliveHandlerTest(com.ning.http.client.async.jdk.JDKAsyncProviderBasicTest)
asyncRequestVirtualServerPOSTTest(com.ning.http.client.async.jdk.JDKAsyncProviderBasicTest)
testStream(com.ning.http.client.async.apache.ApacheAsyncStreamLifecycleTest)
testStream(com.ning.http.client.async.jdk.JDKAsyncStreamLifecycleTest)
basicAuthTimeoutTest(com.ning.http.client.async.jdk.JDKAuthTimeoutTest)
basicFutureAuthTimeoutTest(com.ning.http.client.async.jdk.JDKAuthTimeoutTest)
basicFuturePreemptiveAuthTimeoutTest(com.ning.http.client.async.jdk.JDKAuthTimeoutTest)
basicPreemptiveAuthTimeoutTest(com.ning.http.client.async.jdk.JDKAuthTimeoutTest)
digestAuthTimeoutTest(com.ning.http.client.async.jdk.JDKAuthTimeoutTest)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<parallel>true</parallel>
<forkMode>once</forkMode>
</configuration>
</plugin>
-------------------------------------------------------
Running TestSuite
org.apache.maven.surefire.booter.SurefireExecutionException: java.lang.String cannot be cast to java.lang.Integer; nested exception is java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at org.testng.TestNG.configure(TestNG.java:1292)
at org.apache.maven.surefire.testng.conf.TestNGMapConfigurator.configure(TestNGMapConfigurator.java:97)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:58)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:144)
at org.apache.maven.surefire.Surefire.run(Surefire.java:169)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
testPutBytes(org.sonatype.ahc.suite.NonPreemptiveAuthPutTest) Time elapsed: 0.001 sec <<< FAILURE!
java.lang.IllegalStateException: No such servlet: org.sonatype.tests.http.server.jetty.impl.BehaviourServlet-1553850145
at org.eclipse.jetty.servlet.ServletHandler.updateMappings(ServletHandler.java:1048)
at org.eclipse.jetty.servlet.ServletHandler.setServletMappings(ServletHandler.java:1139)
at org.eclipse.jetty.servlet.ServletHandler.addServletWithMapping(ServletHandler.java:774)
at org.sonatype.tests.http.server.jetty.impl.JettyServerProvider.addServlet(JettyServerProvider.java:340)
at org.sonatype.tests.http.server.jetty.impl.JettyServerProvider.addBehaviour(JettyServerProvider.java:468)
at org.sonatype.ahc.suite.PutTest.testPutBytes(PutTest.java:131)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[http-8080-exec-2] LISTENING to 'aaaa'
Dec 7, 2010 2:20:44 PM org.atmosphere.handler.ReflectorServletProcessor onRequest
SEVERE: onRequest
javax.servlet.ServletException: Throwable
at org.atmosphere.util.AtmosphereFilterChain.doFilter(AtmosphereFilterChain.java:165)
at org.atmosphere.util.AtmosphereFilterChain.invokeFilterChain(AtmosphereFilterChain.java:116)
at org.atmosphere.handler.ReflectorServletProcessor$FilterChainServletWrapper.service(ReflectorServletProcessor.java:271)
at org.atmosphere.handler.ReflectorServletProcessor.onRequest(ReflectorServletProcessor.java:135)
at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:193)
at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:145)
// IOException, Network outage resumable download.
AsyncHttpClient c = new AsyncHttpClient(new AsyncHttpClientConfig.Builder()
.addIOExceptionFilter(new ResumableIOExceptionFilter()).build());
Response r = c.prepareGet("http://192.168.2.106:8081/800m.avi").execute(a).get();
@jfarcand
jfarcand / gist:739014
Created December 13, 2010 14:10
Atmosphere Sample
@Path("/")
@Produces("text/plain;charset=ISO-8859-1")
public class SimpleSimpleSimple {
@GET
@Suspend(listeners = {EventsLogger.class})
public String subscribe() {
return "<!--Suspended-->";
}
}