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