### Question:
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return response; } private  Info(); static boolean matches(final String path); static FullHttpResponse response(final SockJsConfig config, final HttpRequest request);  }### Answer:
@Test public void webSocketSupported() throws Exception { final SockJsConfig config = SockJsConfig.withPrefix("/simplepush").build(); final FullHttpResponse response = Info.response(config, createHttpRequest("/simplepush")); assertThat(infoAsJson(response).get("websocket").asBoolean(), is(true)); response.release(); }
@Test public void webSocketNotSupported() throws Exception { final SockJsConfig config = SockJsConfig.withPrefix("/simplepush").disableWebSocket().build(); final FullHttpResponse response = Info.response(config, createHttpRequest("/simplepush")); assertThat(infoAsJson(response).get("websocket").asBoolean(), is(false)); response.release(); }
@Test public void cookiesNeeded() throws Exception { final SockJsConfig config = SockJsConfig.withPrefix("/simplepush").disableWebSocket().cookiesNeeded().build(); final FullHttpResponse response = Info.response(config, createHttpRequest("/simplepush")); assertThat(infoAsJson(response).get("cookie_needed").asBoolean(), is(true)); response.release(); }
@Test public void cookiesNotNeeded() throws Exception { final SockJsConfig config = SockJsConfig.withPrefix("/simplepush").disableWebSocket().build(); final FullHttpResponse response = Info.response(config, createHttpRequest("/simplepush")); assertThat(infoAsJson(response).get("cookie_needed").asBoolean(), is(false)); response.release(); }
@Test public void origins() throws Exception { final SockJsConfig config = SockJsConfig.withPrefix("/simplepush").disableWebSocket().build(); final FullHttpResponse response = Info.response(config, createHttpRequest("/simplepush")); assertThat(infoAsJson(response).get("origins").get(0).asText(), is("*:*")); response.release(); }
@Test public void entropy() throws Exception { final SockJsConfig config = SockJsConfig.withPrefix("/simplepush").disableWebSocket().build(); final FullHttpResponse response = Info.response(config, createHttpRequest("/simplepush")); assertThat(infoAsJson(response).get("entropy").asLong(), is(notNullValue())); response.release(); }