Package org.eclipse.jetty.websocket.api

Examples of org.eclipse.jetty.websocket.api.UpgradeRequest


            future.get(500,TimeUnit.MILLISECONDS);

            Assert.assertTrue(wsocket.openLatch.await(1,TimeUnit.SECONDS));

            Session session = wsocket.getSession();
            UpgradeRequest req = session.getUpgradeRequest();
            Assert.assertThat("Upgrade Request",req,notNullValue());

            Map<String, List<String>> parameterMap = req.getParameterMap();
            Assert.assertThat("Parameter Map",parameterMap,notNullValue());

            Assert.assertThat("Parameter[snack]",parameterMap.get("snack"),is(Arrays.asList(new String[]
            { "cashews" })));
            Assert.assertThat("Parameter[amount]",parameterMap.get("amount"),is(Arrays.asList(new String[]
View Full Code Here


            client.connect();
            client.addHeader("Cookie: fruit=Pear; type=Anjou\r\n");
            client.sendStandardRequest();
            client.expectUpgradeResponse();

            UpgradeRequest req = echoCreator.getLastRequest();
            Assert.assertThat("Last Request",req,notNullValue());
            List<HttpCookie> cookies = req.getCookies();
            Assert.assertThat("Request cookies",cookies,notNullValue());
            Assert.assertThat("Request cookies.size",cookies.size(),is(2));
            for (HttpCookie cookie : cookies)
            {
                Assert.assertThat("Cookie name",cookie.getName(),anyOf(is("fruit"),is("type")));
View Full Code Here

  @Test
  public void getPrincipalFromNativeSession() {

    TestPrincipal user = new TestPrincipal("joe");

    UpgradeRequest request = Mockito.mock(UpgradeRequest.class);
    given(request.getUserPrincipal()).willReturn(user);

    UpgradeResponse response = Mockito.mock(UpgradeResponse.class);
    given(response.getAcceptedSubProtocol()).willReturn(null);

    Session nativeSession = Mockito.mock(Session.class);
View Full Code Here

  }

  @Test
  public void getPrincipalNotAvailable() {

    UpgradeRequest request = Mockito.mock(UpgradeRequest.class);
    given(request.getUserPrincipal()).willReturn(null);

    UpgradeResponse response = Mockito.mock(UpgradeResponse.class);
    given(response.getAcceptedSubProtocol()).willReturn(null);

    Session nativeSession = Mockito.mock(Session.class);
View Full Code Here

  @Test
  public void getAcceptedProtocol() {

    String protocol = "foo";

    UpgradeRequest request = Mockito.mock(UpgradeRequest.class);
    given(request.getUserPrincipal()).willReturn(null);

    UpgradeResponse response = Mockito.mock(UpgradeResponse.class);
    given(response.getAcceptedSubProtocol()).willReturn(protocol);

    Session nativeSession = Mockito.mock(Session.class);
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.websocket.api.UpgradeRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.