org.xnio.OptionMap Java Examples

The following examples show how to use org.xnio.OptionMap. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebConfigurerTest.java    From e-commerce-microservice with Apache License 2.0 7 votes vote down vote up
@Test
public void testCustomizeServletContainer() {
    env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
    UndertowServletWebServerFactory container = new UndertowServletWebServerFactory();
    webConfigurer.customize(container);
    assertThat(container.getMimeMappings().get("abs")).isEqualTo("audio/x-mpeg");
    assertThat(container.getMimeMappings().get("html")).isEqualTo("text/html;charset=utf-8");
    assertThat(container.getMimeMappings().get("json")).isEqualTo("text/html;charset=utf-8");
    if (container.getDocumentRoot() != null) {
        assertThat(container.getDocumentRoot().getPath()).isEqualTo(FilenameUtils.separatorsToSystem("build/www"));
    }

    Builder builder = Undertow.builder();
    container.getBuilderCustomizers().forEach(c -> c.customize(builder));
    OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
    assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isNull();
}
 
Example #2
Source File: HttpServerConnection.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public HttpServerConnection(StreamConnection channel, final ByteBufferPool bufferPool, final HttpHandler rootHandler, final OptionMap undertowOptions, final int bufferSize, final ConnectorStatisticsImpl connectorStatistics) {
    super(channel, bufferPool, rootHandler, undertowOptions, bufferSize);
    if (channel instanceof SslChannel) {
        sslSessionInfo = new ConnectionSSLSessionInfo(((SslChannel) channel), this);
    }
    this.responseConduit = new HttpResponseConduit(channel.getSinkChannel().getConduit(), bufferPool, this);

    fixedLengthStreamSinkConduit = new ServerFixedLengthStreamSinkConduit(responseConduit, false, false);
    readDataStreamSourceConduit = new ReadDataStreamSourceConduit(channel.getSourceChannel().getConduit(), this);
    //todo: do this without an allocation
    addCloseListener(new CloseListener() {
        @Override
        public void closed(ServerConnection connection) {
            if(connectorStatistics != null) {
                connectorStatistics.decrementConnectionCount();
            }
            responseConduit.freeBuffers();
        }
    });
}
 
Example #3
Source File: RemoteOutboundConnectionAdd.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
void installRuntimeService(final OperationContext context, final ModelNode operation, final ModelNode fullModel) throws OperationFailedException {
    final PathAddress address = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR));
    final String connectionName = address.getLastElement().getValue();
    final String outboundSocketBindingRef = RemoteOutboundConnectionResourceDefinition.OUTBOUND_SOCKET_BINDING_REF.resolveModelAttribute(context, operation).asString();
    final ServiceName outboundSocketBindingDependency = context.getCapabilityServiceName(OUTBOUND_SOCKET_BINDING_CAPABILITY_NAME, outboundSocketBindingRef, OutboundSocketBinding.class);
    final OptionMap connOpts = ConnectorUtils.getOptions(context, fullModel.get(CommonAttributes.PROPERTY));
    final String username = RemoteOutboundConnectionResourceDefinition.USERNAME.resolveModelAttribute(context, fullModel).asStringOrNull();
    final String securityRealm = fullModel.hasDefined(CommonAttributes.SECURITY_REALM) ? fullModel.require(CommonAttributes.SECURITY_REALM).asString() : null;
    final String authenticationContext = fullModel.hasDefined(CommonAttributes.AUTHENTICATION_CONTEXT) ? fullModel.require(CommonAttributes.AUTHENTICATION_CONTEXT).asString() : null;
    final String protocol = authenticationContext != null ? null : RemoteOutboundConnectionResourceDefinition.PROTOCOL.resolveModelAttribute(context, operation).asString();

    // create the service
    final ServiceName serviceName = OUTBOUND_CONNECTION_CAPABILITY.getCapabilityServiceName(connectionName);
    final ServiceName aliasServiceName = RemoteOutboundConnectionService.REMOTE_OUTBOUND_CONNECTION_BASE_SERVICE_NAME.append(connectionName);
    final ServiceName deprecatedName = AbstractOutboundConnectionService.OUTBOUND_CONNECTION_BASE_SERVICE_NAME.append(connectionName);

    final ServiceBuilder<?> builder = context.getServiceTarget().addService(serviceName);
    final Consumer<RemoteOutboundConnectionService> serviceConsumer = builder.provides(deprecatedName, aliasServiceName);
    final Supplier<OutboundSocketBinding> osbSupplier = builder.requires(outboundSocketBindingDependency);
    final Supplier<SecurityRealm> srSupplier = securityRealm != null ? SecurityRealm.ServiceUtil.requires(builder, securityRealm) : null;
    final Supplier<AuthenticationContext> acSupplier = authenticationContext != null ? builder.requires(context.getCapabilityServiceName(AUTHENTICATION_CONTEXT_CAPABILITY, authenticationContext, AuthenticationContext.class)) : null;
    builder.requires(RemotingServices.SUBSYSTEM_ENDPOINT);
    builder.setInstance(new RemoteOutboundConnectionService(serviceConsumer, osbSupplier, srSupplier, acSupplier, connOpts, username, protocol));
    builder.install();
}
 
Example #4
Source File: WebConfigurerTest.java    From TeamDojo with Apache License 2.0 6 votes vote down vote up
@Test
public void testCustomizeServletContainer() {
    env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
    UndertowServletWebServerFactory container = new UndertowServletWebServerFactory();
    webConfigurer.customize(container);
    assertThat(container.getMimeMappings().get("abs")).isEqualTo("audio/x-mpeg");
    assertThat(container.getMimeMappings().get("html")).isEqualTo("text/html;charset=utf-8");
    assertThat(container.getMimeMappings().get("json")).isEqualTo("text/html;charset=utf-8");
    if (container.getDocumentRoot() != null) {
        assertThat(container.getDocumentRoot().getPath()).isEqualTo(FilenameUtils.separatorsToSystem("build/www"));
    }

    Builder builder = Undertow.builder();
    container.getBuilderCustomizers().forEach(c -> c.customize(builder));
    OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
    assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isNull();
}
 
Example #5
Source File: ChannelServer.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void addChannelOpenListener(final String channelName, final OpenListener openListener) throws ServiceRegistrationException {
    registration = endpoint.registerService(channelName, new OpenListener() {
        public void channelOpened(final Channel channel) {
            if (openListener != null) {
                openListener.channelOpened(channel);
            }
        }

        public void registrationTerminated() {
            if (openListener != null) {
                openListener.registrationTerminated();
            }
        }
    }, OptionMap.EMPTY);

}
 
Example #6
Source File: DomainTestConnection.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
Channel openChannel(final Connection connection) throws IOException {
    final IoFuture<Channel> future = connection.openChannel(DEFAULT_CHANNEL_SERVICE_TYPE, OptionMap.EMPTY);
    future.await(10L, TimeUnit.SECONDS);
    if (future.getStatus() == IoFuture.Status.WAITING) {
        future.cancel();
        throw ProtocolLogger.ROOT_LOGGER.channelTimedOut();
    }
    final Channel channel = future.get();
    channel.addCloseHandler(new CloseHandler<Channel>() {
        @Override
        public void handleClose(final Channel old, final IOException e) {
            synchronized (ChannelStrategy.this) {
                if(ChannelStrategy.this.channel == old) {
                    ChannelStrategy.this.handler.handleClose(old, e);
                    ChannelStrategy.this.channel = null;
                }
            }
            handler.handleChannelClosed(old, e);
        }
    });
    return channel;
}
 
Example #7
Source File: UndertowClient.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public IoFuture<ClientConnection> connect(InetSocketAddress bindAddress, final URI uri, final XnioWorker worker, XnioSsl ssl, ByteBufferPool bufferPool, OptionMap options) {
    ClientProvider provider = getClientProvider(uri);
    final FutureResult<ClientConnection> result = new FutureResult<>();
    provider.connect(new ClientCallback<ClientConnection>() {
        @Override
        public void completed(ClientConnection r) {
            result.setResult(r);
        }

        @Override
        public void failed(IOException e) {
            result.setException(e);
        }
    }, bindAddress, uri, worker, ssl, bufferPool, options);
    return result.getIoFuture();
}
 
Example #8
Source File: WebConfigurerTest.java    From jhipster-microservices-example with Apache License 2.0 6 votes vote down vote up
@Test
public void testCustomizeServletContainer() {
    env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
    UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
    webConfigurer.customize(container);
    assertThat(container.getMimeMappings().get("abs")).isEqualTo("audio/x-mpeg");
    assertThat(container.getMimeMappings().get("html")).isEqualTo("text/html;charset=utf-8");
    assertThat(container.getMimeMappings().get("json")).isEqualTo("text/html;charset=utf-8");
    if (container.getDocumentRoot() != null) {
        assertThat(container.getDocumentRoot().getPath()).isEqualTo(FilenameUtils.separatorsToSystem("target/www"));
    }

    Builder builder = Undertow.builder();
    container.getBuilderCustomizers().forEach(c -> c.customize(builder));
    OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
    assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isNull();
}
 
Example #9
Source File: WebConfigurerTest.java    From cubeai with Apache License 2.0 6 votes vote down vote up
@Test
public void testCustomizeServletContainer() {
    env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
    UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
    webConfigurer.customize(container);
    assertThat(container.getMimeMappings().get("abs")).isEqualTo("audio/x-mpeg");
    assertThat(container.getMimeMappings().get("html")).isEqualTo("text/html;charset=utf-8");
    assertThat(container.getMimeMappings().get("json")).isEqualTo("text/html;charset=utf-8");
    if (container.getDocumentRoot() != null) {
        assertThat(container.getDocumentRoot().getPath()).isEqualTo(FilenameUtils.separatorsToSystem("target/www"));
    }

    Builder builder = Undertow.builder();
    container.getBuilderCustomizers().forEach(c -> c.customize(builder));
    OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
    assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isNull();
}
 
Example #10
Source File: OptionAttributeDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@SuppressWarnings("unchecked")
public OptionMap.Builder resolveOption(final ExpressionResolver context, final ModelNode model, OptionMap.Builder builder) throws OperationFailedException {
    ModelNode value = resolveModelAttribute(context, model);
    if (value.isDefined()) {
        if (getType() == ModelType.INT) {
            builder.set((Option<Integer>) option, value.asInt());
        } else if (getType() == ModelType.LONG) {
            builder.set(option, value.asLong());
        } else if (getType() == ModelType.BOOLEAN) {
            builder.set(option, value.asBoolean());
        } else if (optionType.isEnum()) {
            builder.set(option, option.parseValue(value.asString(), option.getClass().getClassLoader()));
        }else if (option.getClass().getSimpleName().equals("SequenceOption")) {
            builder.setSequence(option, value.asString().split("\\s*,\\s*"));
        } else if (getType() == ModelType.STRING) {
            builder.set(option, value.asString());
        } else {
            throw new OperationFailedException("Don't know how to handle: " + option + " with value: " + value);
        }
    }
    return builder;
}
 
Example #11
Source File: Http2ClientProvider.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private ChannelListener<StreamConnection> createOpenListener(final ClientCallback<ClientConnection> listener, final URI uri, final XnioSsl ssl, final ByteBufferPool bufferPool, final OptionMap options) {
    return new ChannelListener<StreamConnection>() {
        @Override
        public void handleEvent(StreamConnection connection) {
            handleConnected(connection, listener, uri, bufferPool, options);
        }
    };
}
 
Example #12
Source File: Http2PriorKnowledgeClientProvider.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void connect(final ClientCallback<ClientConnection> listener, InetSocketAddress bindAddress, final URI uri, final XnioWorker worker, final XnioSsl ssl, final ByteBufferPool bufferPool, final OptionMap options) {

    if (bindAddress == null) {
        worker.openStreamConnection(new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()), createOpenListener(listener, bufferPool, options, uri.getHost()), options).addNotifier(createNotifier(listener), null);
    } else {
        worker.openStreamConnection(bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()), createOpenListener(listener, bufferPool, options, uri.getHost()), null, options).addNotifier(createNotifier(listener), null);
    }}
 
Example #13
Source File: WebConfigurerTest.java    From 21-points with Apache License 2.0 5 votes vote down vote up
@Test
public void testUndertowHttp2Enabled() {
    props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0);
    UndertowServletWebServerFactory container = new UndertowServletWebServerFactory();
    webConfigurer.customize(container);
    Builder builder = Undertow.builder();
    container.getBuilderCustomizers().forEach(c -> c.customize(builder));
    OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
    assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isTrue();
}
 
Example #14
Source File: WebConfigurerTest.java    From Spring-5.0-Projects with MIT License 5 votes vote down vote up
@Test
public void testUndertowHttp2Enabled() {
    props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0);
    UndertowServletWebServerFactory container = new UndertowServletWebServerFactory();
    webConfigurer.customize(container);
    Builder builder = Undertow.builder();
    container.getBuilderCustomizers().forEach(c -> c.customize(builder));
    OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
    assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isTrue();
}
 
Example #15
Source File: WebConfigurerTest.java    From Full-Stack-Development-with-JHipster with MIT License 5 votes vote down vote up
@Test
public void testUndertowHttp2Enabled() {
    props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0);
    UndertowServletWebServerFactory container = new UndertowServletWebServerFactory();
    webConfigurer.customize(container);
    Builder builder = Undertow.builder();
    container.getBuilderCustomizers().forEach(c -> c.customize(builder));
    OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
    assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isTrue();
}
 
Example #16
Source File: WebConfigurerTest.java    From tutorials with MIT License 5 votes vote down vote up
@Test
public void testUndertowHttp2Enabled() {
    props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0);
    UndertowServletWebServerFactory container = new UndertowServletWebServerFactory();
    webConfigurer.customize(container);
    Builder builder = Undertow.builder();
    container.getBuilderCustomizers().forEach(c -> c.customize(builder));
    OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
    assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isTrue();
}
 
Example #17
Source File: ModClusterContainer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
ModClusterContainer(final ModCluster modCluster, final XnioSsl xnioSsl, final UndertowClient client, OptionMap clientOptions) {
    this.xnioSsl = xnioSsl;
    this.client = client;
    this.modCluster = modCluster;
    this.clientOptions = clientOptions;
    this.healthChecker = modCluster.getHealthChecker();
    this.proxyClient = new ModClusterProxyClient(null, this);
    this.removeBrokenNodesThreshold = removeThreshold(modCluster.getHealthCheckInterval(), modCluster.getRemoveBrokenNodes());
}
 
Example #18
Source File: ModClusterProxyServer.java    From quarkus-http with Apache License 2.0 5 votes vote down vote up
public static void main(final String[] args) throws IOException {
    final XnioWorker worker = Xnio.getInstance().createWorker(OptionMap.EMPTY);
    final Undertow server;

    final ModCluster modCluster = ModCluster.builder(worker).build();
    try {
        if (chost == null) {
            // We are going to guess it.
            chost = java.net.InetAddress.getLocalHost().getHostName();
            System.out.println("Using: " + chost + ":" + cport);
        }

        modCluster.start();

        // Create the proxy and mgmt handler
        final HttpHandler proxy = modCluster.createProxyHandler();
        final MCMPConfig config = MCMPConfig.webBuilder()
                .setManagementHost(chost)
                .setManagementPort(cport)
                .enableAdvertise()
                .getParent()
                .build();

        final HttpHandler mcmp = config.create(modCluster, proxy);

        server = Undertow.builder()
                .addHttpListener(cport, chost)
                .addHttpListener(pport, phost)
                .setHandler(mcmp)
                .build();
        server.start();

        // Start advertising the mcmp handler
        modCluster.advertise(config);

    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example #19
Source File: HttpRequestParser.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public static final HttpRequestParser instance(final OptionMap options) {
    try {
        final Class<?> cls = Class.forName(HttpRequestParser.class.getName() + "$$generated", false, HttpRequestParser.class.getClassLoader());

        Constructor<?> ctor = cls.getConstructor(OptionMap.class);
        return (HttpRequestParser) ctor.newInstance(options);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example #20
Source File: TokenAuthenticator.java    From hawkular-metrics with Apache License 2.0 5 votes vote down vote up
private ConnectionFactory(URI kubernetesMasterUri) {
    this.kubernetesMasterUri = kubernetesMasterUri;
    undertowClient = UndertowClient.getInstance();
    Xnio xnio = Xnio.getInstance(Undertow.class.getClassLoader());
    try {
        ssl = new UndertowXnioSsl(xnio, OptionMap.EMPTY);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    byteBufferPool = createByteBufferPool();
}
 
Example #21
Source File: HttpRequestParser.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public HttpRequestParser(OptionMap options) {
    maxParameters = options.get(UndertowOptions.MAX_PARAMETERS, UndertowOptions.DEFAULT_MAX_PARAMETERS);
    maxHeaders = options.get(UndertowOptions.MAX_HEADERS, UndertowOptions.DEFAULT_MAX_HEADERS);
    allowEncodedSlash = options.get(UndertowOptions.ALLOW_ENCODED_SLASH, false);
    decode = options.get(UndertowOptions.DECODE_URL, true);
    charset = options.get(UndertowOptions.URL_CHARSET, StandardCharsets.UTF_8.name());
    maxCachedHeaderSize = options.get(UndertowOptions.MAX_CACHED_HEADER_SIZE, UndertowOptions.DEFAULT_MAX_CACHED_HEADER_SIZE);
    this.allowUnescapedCharactersInUrl = options.get(UndertowOptions.ALLOW_UNESCAPED_CHARACTERS_IN_URL, false);
}
 
Example #22
Source File: ManagementClientChannelStrategy.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected Channel openChannel(final Connection connection, final String serviceType, final OptionMap options) throws IOException {
    // This is only called as part of the connectionManager.connect() handling in getChannel() above.
    // So, we should hold the connectionManager lock. We want to ensure that so we know we have the right deadline.
    // We could synchronize again on connectionManager to ensure that, but then if there is some corner case
    // the analysis missed where this gets called asynchronously during connectionManager.connect() handling
    // we would deadlock. Better to fail than to deadlock. Use an ISE instead of an assert because if this
    // fails, we don't want an Error; we want something that should eventually be caught and handled.
    if (!Thread.holdsLock(connectionManager)) {
        throw new IllegalStateException();
    }
    final Channel channel = openChannel(connection, serviceType, options, deadline);
    channel.addCloseHandler(closeHandler);
    return channel;
}
 
Example #23
Source File: RequestParserTest.java    From core-ng-project with Apache License 2.0 5 votes vote down vote up
@Test
void parseInvalidCookie() {
    ServerConnection connection = mock(ServerConnection.class);
    when(connection.getUndertowOptions()).thenReturn(OptionMap.EMPTY);
    var exchange = new HttpServerExchange(connection, -1);
    exchange.getRequestHeaders().put(Headers.COOKIE, "name=invalid-" + (char) 232);

    assertThatThrownBy(() -> parser.parseCookies(new RequestImpl(null, null), exchange))
            .isInstanceOf(BadRequestException.class);
}
 
Example #24
Source File: RemoteChannelPairSetup.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void startClientConnetion() throws IOException, URISyntaxException {
    ProtocolConnectionConfiguration configuration = ProtocolConnectionConfiguration.create(channelServer.getEndpoint(),
            new URI("" + URI_SCHEME + "://127.0.0.1:" + PORT + ""));

    connection = configuration.getEndpoint().getConnection(configuration.getUri()).get();

    clientChannel = connection.openChannel(TEST_CHANNEL, OptionMap.EMPTY).get();
    try {
        clientConnectedLatch.await();
    } catch (InterruptedException e) {
        throw new RuntimeException(e);
    }
}
 
Example #25
Source File: Http2ClientProvider.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public static ALPNClientSelector.ALPNProtocol alpnProtocol(final ClientCallback<ClientConnection> listener, URI uri, ByteBufferPool bufferPool, OptionMap options) {
    return new ALPNClientSelector.ALPNProtocol(new ChannelListener<SslConnection>() {
        @Override
        public void handleEvent(SslConnection connection) {
            listener.completed(createHttp2Channel(connection, bufferPool, options, uri.getHost()));
        }
    }, HTTP2);
}
 
Example #26
Source File: IOSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testSequence() throws Exception {
    OptionMap.Builder builder = OptionMap.builder();
    ModelNode model = new ModelNode();
    ModelNode operation = new ModelNode();
    operation.get(ENABLED_PROTOCOLS.getName()).set("TLSv1, TLSv1.1, TLSv1.2");
    ENABLED_PROTOCOLS.validateAndSet(operation, model);
    ENABLED_PROTOCOLS.resolveOption(ExpressionResolver.SIMPLE, model, builder);
    Sequence<String> protocols = builder.getMap().get(Options.SSL_ENABLED_PROTOCOLS);
    Assert.assertEquals(3, protocols.size());
    Assert.assertEquals("TLSv1", protocols.get(0));
    Assert.assertEquals("TLSv1.1", protocols.get(1));
    Assert.assertEquals("TLSv1.2", protocols.get(2));

}
 
Example #27
Source File: Undertow.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private ListenerConfig(final ListenerType type, final int port, final String host, KeyManager[] keyManagers, TrustManager[] trustManagers, HttpHandler rootHandler) {
    this.type = type;
    this.port = port;
    this.host = host;
    this.keyManagers = keyManagers;
    this.trustManagers = trustManagers;
    this.rootHandler = rootHandler;
    this.sslContext = null;
    this.overrideSocketOptions = OptionMap.EMPTY;
    this.useProxyProtocol = false;
}
 
Example #28
Source File: UndertowOptionMapConfigurationTest.java    From galeb with Apache License 2.0 5 votes vote down vote up
@Test
public void testBuildUndertowOptionMapFromEnvironmentWithOptionKeepAlive() throws Exception {
    
    HashMap<String, String> env = new HashMap<String, String>();
    env.put("UNDERTOW_OPTIONS_KEEP_ALIVE", "true");
    
    UndertowOptionMapConfiguration undertowOptionMapConfiguration = new UndertowOptionMapConfiguration();
    OptionMap optionMap = undertowOptionMapConfiguration.buildUndertowOptionMapFromEnvironment("UNDERTOW_OPTIONS_", env);
    
    Assert.assertEquals(optionMap.get(Options.KEEP_ALIVE, false), true);
}
 
Example #29
Source File: UndertowXhrTransport.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public IoFuture<ClientConnection> httpClientConnect(UndertowClient httpClient, URI uri,
		XnioWorker worker, OptionMap options) {
	return (IoFuture<ClientConnection>) ReflectionUtils.invokeMethod(httpClientConnectMethod, httpClient, uri,
			worker, this.undertowBufferPool, options);
}
 
Example #30
Source File: HttpClientProvider.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private ChannelListener<StreamConnection> createOpenListener(final ClientCallback<ClientConnection> listener, final ByteBufferPool bufferPool, final OptionMap options, final URI uri) {
    return new ChannelListener<StreamConnection>() {
        @Override
        public void handleEvent(StreamConnection connection) {
            handleConnected(connection, listener, bufferPool, options, uri);
        }
    };
}