15
15
16
16
import static org .asynchttpclient .Dsl .*;
17
17
import static org .asynchttpclient .test .TestUtils .*;
18
- import static org .testng .Assert .assertEquals ;
18
+ import static org .testng .Assert .* ;
19
19
20
20
import java .io .IOException ;
21
21
import java .util .concurrent .CountDownLatch ;
22
- import java .util .concurrent .atomic .AtomicReference ;
22
+ import java .util .concurrent .atomic .AtomicBoolean ;
23
23
24
24
import javax .servlet .ServletException ;
25
25
import javax .servlet .http .HttpServletRequest ;
@@ -72,17 +72,17 @@ public void configure(WebSocketServletFactory factory) {
72
72
}
73
73
74
74
75
- @ Test (groups = "standalone" , timeOut = 60000 )
75
+ @ Test (groups = "standalone" )
76
76
public void testRedirectToWSResource () throws Exception {
77
77
try (AsyncHttpClient c = asyncHttpClient (config ().setFollowRedirect (true ))) {
78
78
final CountDownLatch latch = new CountDownLatch (1 );
79
- final AtomicReference < String > text = new AtomicReference <>( "" );
79
+ final AtomicBoolean onOpenCalled = new AtomicBoolean ( );
80
80
81
81
WebSocket websocket = c .prepareGet (getRedirectURL ()).execute (new WebSocketUpgradeHandler .Builder ().addWebSocketListener (new WebSocketListener () {
82
82
83
83
@ Override
84
84
public void onOpen (WebSocket websocket ) {
85
- text .set ("OnOpen" );
85
+ onOpenCalled .set (true );
86
86
latch .countDown ();
87
87
}
88
88
@@ -98,7 +98,7 @@ public void onError(Throwable t) {
98
98
}).build ()).get ();
99
99
100
100
latch .await ();
101
- assertEquals ( text .get (), "OnOpen" );
101
+ assertTrue ( onOpenCalled .get ());
102
102
websocket .close ();
103
103
}
104
104
}
0 commit comments