Package org.eclipse.jetty.server

Examples of org.eclipse.jetty.server.ConnectionFactory


    public void benchmarkPushStrategy() throws Exception
    {
        InetSocketAddress address = startHTTPServer(version, new PushStrategyBenchmarkHandler(), 30000);

        // Plain HTTP
        ConnectionFactory factory = new HttpConnectionFactory(new HttpConfiguration());
        connector.setDefaultProtocol(factory.getProtocol());
        HttpClient httpClient = new HttpClient();
        // Simulate browsers, that open 6 connection per origin
        httpClient.setMaxConnectionsPerDestination(6);
        httpClient.start();
        benchmarkHTTP(httpClient);
        httpClient.stop();

        // First push strategy
        PushStrategy pushStrategy = new PushStrategy.None();
        factory = new HTTPSPDYServerConnectionFactory(version, new HttpConfiguration(), pushStrategy);
        connector.setDefaultProtocol(factory.getProtocol());
        Session session = startClient(version, address, new ClientSessionFrameListener());
        benchmarkSPDY(pushStrategy, session);
        session.goAway(new GoAwayInfo(5, TimeUnit.SECONDS));

        // Second push strategy
        pushStrategy = new ReferrerPushStrategy();
        factory = new HTTPSPDYServerConnectionFactory(version, new HttpConfiguration(), pushStrategy);
        connector.setDefaultProtocol(factory.getProtocol());
        session = startClient(version, address, new ClientSessionFrameListener());
        benchmarkSPDY(pushStrategy, session);
        session.goAway(new GoAwayInfo(5, TimeUnit.SECONDS));
    }
View Full Code Here


        if (connector == null)
            connector = newSPDYServerConnector(server, listener);
        if (listener == null)
            listener = connector.getConnectionFactory(SPDYServerConnectionFactory.class).getServerSessionFrameListener();

        ConnectionFactory spdy = new SPDYServerConnectionFactory(version, listener);
        connector.addConnectionFactory(spdy);
        connector.setPort(0);
        server.addConnector(connector);

        if (connector.getConnectionFactory(NPNServerConnectionFactory.class)!=null)
            connector.getConnectionFactory(NPNServerConnectionFactory.class).setDefaultProtocol(spdy.getProtocol());
        else
            connector.setDefaultProtocol(spdy.getProtocol());

        server.start();
        return new InetSocketAddress("localhost", connector.getLocalPort());
    }
View Full Code Here

                    fillInterested();
                }
            }
            else
            {
                ConnectionFactory connectionFactory = connector.getConnectionFactory(protocol);
                if (connectionFactory == null)
                {
                    LOG.debug("{} application selected protocol '{}', but no correspondent {} has been configured",
                            this, protocol, ConnectionFactory.class.getName());
                    close();
                }
                else
                {
                    EndPoint endPoint = getEndPoint();
                    Connection oldConnection = endPoint.getConnection();
                    Connection newConnection = connectionFactory.newConnection(connector, endPoint);
                    LOG.debug("{} switching from {} to {}", this, oldConnection, newConnection);
                    oldConnection.onClose();
                    endPoint.setConnection(newConnection);
                    getEndPoint().getConnection().onOpen();
                }
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.server.ConnectionFactory

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.