@Test(expected = NotConnectedException.class)
public void testGetRealtimeWebSocketURI_withBadResponse() throws Exception {

    WebResource mockRtmResrc = mock(WebResource.class);
    when(mockResource.path("rtm.start")).thenReturn(mockRtmResrc);
    when(mockRtmResrc.queryParam(anyString(), anyString())).thenReturn(mockRtmResrc);
    Builder builder = mock(Builder.class);
    String errorReason = "broken";
    String jsonResult = String.format("{\"ok\":false, \"error\":\"%s\"}", errorReason);
    when(builder.get(String.class)).thenReturn(jsonResult);
    when(mockRtmResrc.accept(MediaType.APPLICATION_JSON)).thenReturn(builder);
    underTest.getRealtimeWebSocketURI();
}