Package org.eclipse.jetty.server

Examples of org.eclipse.jetty.server.HttpConnectionFactory


{
    @Test
    public void testClientAdvertisingHTTPServerSpeaksHTTP() throws Exception
    {
        InetSocketAddress address = prepare();
        connector.addConnectionFactory(new HttpConnectionFactory());

        SslContextFactory sslContextFactory = newSslContextFactory();
        sslContextFactory.start();
        SSLContext sslContext = sslContextFactory.getSslContext();
View Full Code Here


    @Test
    public void testClientAdvertisingMultipleProtocolsServerSpeaksHTTPWhenNegotiated() throws Exception
    {
        InetSocketAddress address = prepare();
        connector.addConnectionFactory(new HttpConnectionFactory());

        SslContextFactory sslContextFactory = newSslContextFactory();
        sslContextFactory.start();
        SSLContext sslContext = sslContextFactory.getSslContext();
        try (SSLSocket client = (SSLSocket)sslContext.getSocketFactory().createSocket(address.getAddress(), address.getPort()))
View Full Code Here

    @Test
    public void testClientNotSupportingALPNServerSpeaksDefaultProtocol() throws Exception
    {
        InetSocketAddress address = prepare();
        connector.addConnectionFactory(new HttpConnectionFactory());

        SslContextFactory sslContextFactory = newSslContextFactory();
        sslContextFactory.start();
        SSLContext sslContext = sslContextFactory.getSslContext();
        try (SSLSocket client = (SSLSocket)sslContext.getSocketFactory().createSocket(address.getAddress(), address.getPort()))
View Full Code Here

    {
        super(server, Objects.requireNonNull(sslContextFactory),
                negotiator,
                new SPDYServerConnectionFactory(SPDY.V3, listener),
                new SPDYServerConnectionFactory(SPDY.V2, listener),
                new HttpConnectionFactory());
        negotiator.setDefaultProtocol("http/1.1");
    }
View Full Code Here

{
    @Test
    public void testServerAdvertisingHTTPSpeaksHTTP() throws Exception
    {
        InetSocketAddress address = prepare();
        connector.addConnectionFactory(new HttpConnectionFactory());

        SslContextFactory sslContextFactory = newSslContextFactory();
        sslContextFactory.start();
        SSLContext sslContext = sslContextFactory.getSslContext();
View Full Code Here

    @Test
    public void testServerAdvertisingSPDYAndHTTPSpeaksHTTPWhenNegotiated() throws Exception
    {
        InetSocketAddress address = prepare();
        connector.addConnectionFactory(new HttpConnectionFactory());

        SslContextFactory sslContextFactory = newSslContextFactory();
        sslContextFactory.start();
        SSLContext sslContext = sslContextFactory.getSslContext();
        try (SSLSocket client = (SSLSocket)sslContext.getSocketFactory().createSocket(address.getAddress(), address.getPort()))
View Full Code Here

    @Test
    public void testServerAdvertisingSPDYAndHTTPSpeaksDefaultProtocolWhenNPNMissing() throws Exception
    {
        InetSocketAddress address = prepare();
        connector.addConnectionFactory(new HttpConnectionFactory());

        SslContextFactory sslContextFactory = newSslContextFactory();
        sslContextFactory.start();
        SSLContext sslContext = sslContextFactory.getSslContext();
        try (SSLSocket client = (SSLSocket)sslContext.getSocketFactory().createSocket(address.getAddress(), address.getPort()))
View Full Code Here

  }
 
  private static void createServerConnector(Server server) {
    HttpConfiguration httpConfig = new HttpConfiguration();
    httpConfig.setSendServerVersion(false);
    HttpConnectionFactory factory = new HttpConnectionFactory(httpConfig);
   
    ServerConnector connector = new ServerConnector(server, factory);
    connector.setPort(serverPort);
   
    if(!StringUtils.hasText(serverHost))
View Full Code Here

        ServletHolder servletHolder = createProvidingServletHolder();
        context.addServlet(servletHolder, path + "/*");

        HttpConfiguration http_config = new HttpConfiguration();
        ServerConnector http = new ServerConnector(server,
                new HttpConnectionFactory(http_config));
        http.setPort(port);

        if (secure) {

            http_config.setSecureScheme("https");
            http_config.setSecurePort(8443);
            http_config.setOutputBufferSize(32768);

            final KeyStore keystore = getKeyStore();
            SslContextFactory sslContextFactory = new SslContextFactory(true);
            sslContextFactory.setKeyStore(keystore);
            sslContextFactory.setCertAlias("jetty");
            sslContextFactory.setKeyStorePassword("ignored");
            sslContextFactory.setKeyManagerPassword("ignored");
            sslContextFactory.setTrustAll(true);
            HttpConfiguration https_config = new HttpConfiguration(http_config);
            https_config.addCustomizer(new SecureRequestCustomizer());

            ServerConnector https = new ServerConnector(server,
                    new SslConnectionFactory(sslContextFactory, "http/1.1"),
                    new HttpConnectionFactory(https_config));
            https.setPort(port);
            server.setConnectors(new Connector[] { https });

        } else {
            server.setConnectors(new Connector[] { http });
View Full Code Here

            config.setSecurePort(port);
            config.addCustomizer(new SecureRequestCustomizer());

            final ServerConnector https = new ServerConnector(server,
                    new SslConnectionFactory(sslContextFactory, "http/1.1"),
                    new HttpConnectionFactory(config));
            https.setPort(port);
            server.setConnectors(new Connector[]{https});

        } else {
            final ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(config));
            http.setPort(port);
            server.setConnectors(new Connector[]{http});
        }
        if (handler != null) {
            server.setHandler(handler);
View Full Code Here

TOP

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

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.