final ProtocolChannelClient.Configuration configuration = new ProtocolChannelClient.Configuration(); configuration.setUri(new URI("remote://" + NetworkUtils.formatPossibleIpv6Address(localHostInfo.getRemoteDomainControllerHost()) + ":" + localHostInfo.getRemoteDomainControllerPort())); configuration.setEndpoint(endpointInjector.getValue()); configuration.setOptionMap(options);
@Override public void connectionOpened(final Connection connection) throws IOException { final Channel channel = openChannel(connection, CHANNEL_SERVICE_TYPE, configuration.getOptionMap()); if(setChannel(channel)) { channel.receiveMessage(channelHandler.getReceiver()); channel.addCloseHandler(channelHandler); try { // Start the registration process channelHandler.executeRequest(new RegisterHostControllerRequest(), null).getResult().get(); } catch (Exception e) { if(e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new IOException(e); } // Registered registered(); } else { channel.closeAsync(); } }
static ProtocolChannelClient.Configuration create(final ModelControllerClientConfiguration client) throws URISyntaxException { final ProtocolChannelClient.Configuration configuration = new ProtocolChannelClient.Configuration(); if(client.getProtocol() == null) { // WFLY-1462 for compatibility assume remoting if the standard native port is configured String protocol = client.getPort() == 9999 ? "remote://" : "http-remoting://"; configuration.setUri(new URI(protocol + formatPossibleIpv6Address(client.getHost()) + ":" + client.getPort())); } else { configuration.setUri(new URI(client.getProtocol() + "://" + formatPossibleIpv6Address(client.getHost()) + ":" + client.getPort())); } configuration.setOptionMap(DEFAULT_OPTIONS); final long timeout = client.getConnectionTimeout(); if(timeout > 0) { configuration.setConnectionTimeout(timeout); } return configuration; }
endpoint.addConnectionProvider("https-remoting", new HttpUpgradeConnectionProviderFactory(), OptionMap.create(Options.SSL_ENABLED, Boolean.TRUE)); configuration.setEndpoint(endpoint);
/** * Create a connection wrapper. * * @param connectionURI the connection URI * @param callbackHandler the callback handler * @return the connection wrapper * @throws IOException */ DomainTestConnection createConnection(final URI connectionURI, final CallbackHandler callbackHandler) throws IOException { final ProtocolChannelClient.Configuration configuration = new ProtocolChannelClient.Configuration(); configuration.setEndpoint(endpoint); configuration.setUri(connectionURI); final ProtocolChannelClient client = ProtocolChannelClient.create(configuration); return new DomainTestConnection(client, callbackHandler, executorService); }
public static ProtocolChannelClient create(final Configuration configuration) throws IOException { if (configuration == null) { throw MESSAGES.nullVar("configuration"); } configuration.validate(); return new ProtocolChannelClient(configuration); }