This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jfarcand:wagon-ahc jfarcand$ pgit | |
error: The requested URL returned error: 401 while accessing https://github.com/sonatype/wagon-ahc.git/info/refs?service=git-receive-pack | |
fatal: HTTP request failed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void fireOnEnd(){ | |
// There is a probability that the asynchronous listener never gets called, so we fake it at the end once | |
// we are 100% sure the response has been received. | |
long count = bytesTransferred.getAndSet(-1); | |
if (count != totalBytesToTransfer.get()) { | |
if (transferAdapter != null) { | |
int leftBytes = (int) (totalBytesToTransfer.get() - count); | |
while (leftBytes > 0) { | |
int length = 8192; | |
if (leftBytes > 8192) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
degulle@WIN-GFQ12AKJ0FR ~/aether-concurrency/aether-concurrency | |
$ cat target/surefire-reports/org.sonatype.aether.extension.concurrency.DefaultFileLockManagerTest.txt | |
------------------------------------------------------------------------------- | |
Test set: org.sonatype.aether.extension.concurrency.DefaultFileLockManagerTest | |
------------------------------------------------------------------------------- | |
Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.016 sec <<< FAILURE! | |
testExternalLockTryReadLock(org.sonatype.aether.extension.concurrency.DefaultFileLockManagerTest) Time elapsed: 0 sec <<< ERROR! | |
java.lang.NoClassDefFoundError: org/sonatype/aether/test/impl/SysoutLogger | |
at org.sonatype.aether.extension.concurrency.DefaultFileLockManagerTest.setup(DefaultFileLockManagerTest.java:36) | |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Properties Based resumable download | |
AsyncHttpClient c = new AsyncHttpClient(); | |
ResumableAsyncHandler a = new ResumableAsyncHandler(new PropertiesBasedResumableProcessor()); | |
a.addResumableListener(new ResumableRandomAccessFileHandler(new RandomAccessFile("800m.avi", "rw"))); | |
Response r = c.prepareGet("http://192.168.2.106:8081/800m.avi").execute(a).get(); | |
// File based resumable download | |
AsyncHttpClient c = new AsyncHttpClient(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jfarcand:ahc-cert-impl jfarcand$ mvn -Dmaven.surefire.debug=true -Dtest=DefaultConnectorTest test | |
[INFO] Scanning for projects... | |
[WARNING] | |
[WARNING] Some problems were encountered while building the effective model for org.sonatype.cert-support:ahc-cert-impl:jar:0.1-SNAPSHOT | |
[WARNING] 'parent.relativePath' of POM org.sonatype.cert-support:cert-support-parent:0.1-SNAPSHOT (/Users/jfarcand/workspace/ahc-cert-service/pom.xml) points at org.atmosphere:atmosphere-project instead of org.sonatype.forge:forge-parent, please verify your project structure @ org.sonatype.cert-support:cert-support-parent:0.1-SNAPSHOT, /Users/jfarcand/workspace/ahc-cert-service/pom.xml, line 4, column 13 | |
[WARNING] | |
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. | |
[WARNING] | |
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects. | |
[WARNING] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder(); | |
config.enableResumableDownload(true); | |
AsyncHttpClient c = new AsyncHttpClient(config.build()); | |
c.prepareGet("http://...").execute(yourAsyncHandler); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test(groups = "standalone") | |
public void basicDefaultTest() throws Throwable { | |
AsyncHttpClientConfig client = new AsyncHttpClientConfig.Builder().setResumableDownload(true).build(); | |
AsyncHttpClient c = new AsyncHttpClient(client); | |
final RandomAccessFile file = new RandomAccessFile("800m.avi", "rw"); | |
Response r = c.prepareGet("http://192.168.2.106:8081/800m.avi").execute(new AsyncCompletionHandlerBase(){ | |
private long byteTransferred = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (byteToRead > 0) { | |
int minBytes = Math.min(8192, byteToRead); | |
byte[] bytes = new byte[minBytes]; | |
int leftBytes = minBytes < 8192 ? 0 : byteToRead - 8192; | |
int read = 0; | |
while (leftBytes > -1) { | |
read = stream.read(bytes); | |
if (read == -1) { | |
break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test(groups = "standalone", enabled = false) | |
public void basicDefaultTest() throws Throwable { | |
AsyncHttpClientConfig client = new AsyncHttpClientConfig.Builder().setResumableDownload(true).build(); | |
AsyncHttpClient c = new AsyncHttpClient(client); | |
final RandomAccessFile file = new RandomAccessFile("shrek1.avi", "rw"); | |
Response r = c.prepareGet("http://192.168.2.106:8081/shrek1.AVI") | |
.setHeader("Range", "bytes=" + file.length() + "-") | |
.execute(new AsyncCompletionHandlerBase() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test(groups = "standalone") | |
public void basicTest() throws Throwable { | |
AsyncHttpClient c = new AsyncHttpClient(); | |
ResumableAsyncHandler<Response> a = new ResumableAsyncHandler<Response>(new PropertiesBasedResumableProcessor()); | |
a.setResumableListener(new ResumableRandomAccessFileHandler(new RandomAccessFile("shrek1.avi", "rw"))); | |
Response r = c.prepareGet("http://192.168.2.106:8081/shrek1.AVI").execute(a).get(); | |
assertEquals(r.getStatusCode(), 200); |