Skip to content

Instantly share code, notes, and snippets.

@jfarcand
Created October 27, 2010 17:59
Show Gist options
  • Save jfarcand/649583 to your computer and use it in GitHub Desktop.
Save jfarcand/649583 to your computer and use it in GitHub Desktop.
public void testPutLargeFile()
throws Exception
{
File file = new File( "/workspace/patch.txt" );
FileInputStream input = new FileInputStream(file);
Realm realm = new Realm.RealmBuilder().setPrincipal( "xxx" ).setPassword( "xxx" ).build();
ProxyServer proxyServer = new ProxyServer(ProxyServer.Protocol.HTTP, "192.168.2.106", 3128);
AsyncHttpClientConfig config =
new AsyncHttpClientConfig.Builder().setRealm( realm ).setProxyServer(proxyServer).setCompressionEnabled( false ).build();
AsyncHttpClient client = new AsyncHttpClient( config );
System.out.println( "START: " + System.currentTimeMillis() );
Future<?> future =
client.preparePut( "https://repository.sonatype.org/service/local/staging/deploy/maven2" )
.setProxyServer(proxyServer).setBody( input ).execute( new TestHandler() );
System.out.println( "DONE: " + System.currentTimeMillis() + ", " + future.get() );
client.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment