use of com.neovisionaries.ws.client.OpeningHandshakeException in project ninja by ninjaframework.
the class ChatWebSocketTest method handshakeUnauthorized.
@Test
public void handshakeUnauthorized() throws IOException, WebSocketException {
String url = withBaseWebSocketUrl("/chat?status=401");
WebSocket ws = new WebSocketFactory().createSocket(url);
try {
ws.connect();
fail("should have failed with a 401");
} catch (OpeningHandshakeException e) {
assertThat(e.getStatusLine().getStatusCode(), is(401));
} finally {
ws.disconnect(WebSocketCloseCode.NORMAL);
}
}
Aggregations