Search in sources :

Example 6 with HttpResponse

use of org.eclipse.jetty.websocket.common.test.HttpResponse in project jetty.project by eclipse.

the class ConfiguratorTest method testNoExtensionsConfigurator.

@Test
public void testNoExtensionsConfigurator() throws Exception {
    URI uri = baseServerUri.resolve("/no-extensions");
    try (IBlockheadClient client = new BlockheadClient(uri)) {
        client.addExtensions("identity");
        client.connect();
        client.sendStandardRequest();
        HttpResponse response = client.expectUpgradeResponse();
        assertThat("response.extensions", response.getExtensionsHeader(), nullValue());
        client.write(new TextFrame().setPayload("NegoExts"));
        EventQueue<WebSocketFrame> frames = client.readFrames(1, 1, TimeUnit.SECONDS);
        WebSocketFrame frame = frames.poll();
        assertThat("Frame Response", frame.getPayloadAsUTF8(), is("negotiatedExtensions=[]"));
    }
}
Also used : IBlockheadClient(org.eclipse.jetty.websocket.common.test.IBlockheadClient) BlockheadClient(org.eclipse.jetty.websocket.common.test.BlockheadClient) TextFrame(org.eclipse.jetty.websocket.common.frames.TextFrame) HttpResponse(org.eclipse.jetty.websocket.common.test.HttpResponse) WebSocketFrame(org.eclipse.jetty.websocket.common.WebSocketFrame) URI(java.net.URI) IBlockheadClient(org.eclipse.jetty.websocket.common.test.IBlockheadClient) Test(org.junit.Test)

Aggregations

BlockheadClient (org.eclipse.jetty.websocket.common.test.BlockheadClient)6 HttpResponse (org.eclipse.jetty.websocket.common.test.HttpResponse)6 Test (org.junit.Test)6 WebSocketFrame (org.eclipse.jetty.websocket.common.WebSocketFrame)4 TextFrame (org.eclipse.jetty.websocket.common.frames.TextFrame)4 URI (java.net.URI)2 IBlockheadClient (org.eclipse.jetty.websocket.common.test.IBlockheadClient)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2