@@ -112,21 +112,22 @@ public void test(String uri, boolean sameClient) {
112112 .join ();
113113 fail ("Expected to throw" );
114114 } catch (CompletionException ce ) {
115- Throwable t = getCompletionCause (ce );
115+ final Throwable t = getCompletionCause (ce );
116116 if (!(t instanceof WebSocketHandshakeException )) {
117117 throw new AssertionError ("Unexpected exception" , t );
118118 }
119- WebSocketHandshakeException wse = (WebSocketHandshakeException ) t ;
119+ final WebSocketHandshakeException wse = (WebSocketHandshakeException ) t ;
120120 assertNotNull (wse .getResponse ());
121- assertNotNull (wse .getResponse ().body ());
122- assertEquals (wse .getResponse ().body ().getClass (), String .class );
123- String body = (String )wse .getResponse ().body ();
124- String expectedBody = "/?&raw=abc+def/ghi=xyz&encoded=abc%2Bdef%2Fghi%3Dxyz" ;
125- assertEquals (body , expectedBody );
126- out .println ("Status code is " + wse .getResponse ().statusCode ());
127- out .println ("Response is " + body );
121+ assertNotNull (wse .getResponse ().uri ());
128122 assertNotNull (wse .getResponse ().statusCode ());
123+ final String rawQuery = wse .getResponse ().uri ().getRawQuery ();
124+ final String expectedRawQuery = "&raw=abc+def/ghi=xyz&encoded=abc%2Bdef%2Fghi%3Dxyz" ;
125+ assertEquals (rawQuery , expectedRawQuery );
126+ final String body = (String ) wse .getResponse ().body ();
127+ final String expectedBody = "/?" + expectedRawQuery ;
128+ assertEquals (body , expectedBody );
129129 out .println ("Status code is " + wse .getResponse ().statusCode ());
130+ out .println ("Response is " + wse .getResponse ());
130131 assertEquals (wse .getResponse ().statusCode (), 400 );
131132 }
132133 }
0 commit comments