Skip to content

Commit 0b73569

Browse files
author
Stephane Landelle
committed
...
1 parent 43bfdb2 commit 0b73569

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

pom.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,31 @@
223223
</extensions>
224224
<defaultGoal>install</defaultGoal>
225225
<plugins>
226+
<plugin>
227+
<groupId>org.apache.maven.plugins</groupId>
228+
<artifactId>maven-shade-plugin</artifactId>
229+
<version>2.0</version>
230+
<executions>
231+
<execution>
232+
<phase>package</phase>
233+
<goals>
234+
<goal>shade</goal>
235+
</goals>
236+
<configuration>
237+
<finalName>microbenchmarks</finalName>
238+
<transformers>
239+
<transformer
240+
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
241+
<mainClass>ntlm.Ntlm</mainClass>
242+
</transformer>
243+
</transformers>
244+
</configuration>
245+
</execution>
246+
</executions>
247+
</plugin>
248+
249+
250+
226251
<plugin>
227252
<groupId>org.apache.maven.plugins</groupId>
228253
<artifactId>maven-compiler-plugin</artifactId>

src/main/java/ntlm/Ntlm.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package ntlm;
2+
3+
import com.ning.http.client.AsyncHttpClient;
4+
import com.ning.http.client.AsyncHttpClientConfig;
5+
import com.ning.http.client.Realm;
6+
import com.ning.http.client.Response;
7+
import com.ning.http.client.Realm.AuthScheme;
8+
import com.ning.http.client.providers.jdk.JDKAsyncHttpProvider;
9+
10+
import java.io.IOException;
11+
import java.util.concurrent.ExecutionException;
12+
13+
public class Ntlm {
14+
15+
public static void main(String[] args) throws InterruptedException, ExecutionException, IOException {
16+
17+
Realm realm = new Realm.RealmBuilder()//
18+
.setPrincipal("corpsignon")//
19+
.setPassword("Tester$1234")//
20+
.setUsePreemptiveAuth(true)//
21+
.setNtlmDomain("SIGNONTESTER.CORP.ORG")
22+
.setNtlmHost("NTLMTESTER")//
23+
.setScheme(AuthScheme.NTLM).build();
24+
25+
AsyncHttpClientConfig.Builder builder = new AsyncHttpClientConfig.Builder().setRealm(realm);
26+
27+
AsyncHttpClient client = new AsyncHttpClient(JDKAsyncHttpProvider.class.getName(), builder.build());
28+
29+
try {
30+
Response response = client.prepareGet("http://localhost:8080").execute().get();
31+
32+
System.err.println(response.getStatusCode());
33+
} finally {
34+
client.close();
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)