use of com.google.cloud.video.livestream.v1.Channel in project wildfly-core by wildfly.
the class RemoteProxyControllerProtocolTestCase method setupProxyHandlers.
private RemoteProxyController setupProxyHandlers(final ModelController proxiedController) {
try {
channels = new RemoteChannelPairSetup();
channels.setupRemoting(new ManagementChannelInitialization() {
@Override
public ManagementChannelHandler startReceiving(Channel channel) {
final ManagementClientChannelStrategy strategy = ManagementClientChannelStrategy.create(channel);
final ManagementChannelHandler support = new ManagementChannelHandler(strategy, channels.getExecutorService());
support.addHandlerFactory(new TransactionalProtocolOperationHandler(proxiedController, support, responseAttachmentSupport));
channel.addCloseHandler(new CloseHandler<Channel>() {
@Override
public void handleClose(Channel closed, IOException exception) {
support.shutdownNow();
}
});
channel.receiveMessage(support.getReceiver());
return support;
}
});
channels.startClientConnetion();
} catch (Exception e) {
throw new RuntimeException(e);
}
final Channel clientChannel = channels.getClientChannel();
final ManagementClientChannelStrategy strategy = ManagementClientChannelStrategy.create(clientChannel);
final ManagementChannelHandler support = new ManagementChannelHandler(strategy, channels.getExecutorService());
final RemoteProxyController proxyController = RemoteProxyController.create(support, PathAddress.pathAddress(), ProxyOperationAddressTranslator.HOST);
clientChannel.addCloseHandler(new CloseHandler<Channel>() {
@Override
public void handleClose(Channel closed, IOException exception) {
support.shutdownNow();
}
});
clientChannel.receiveMessage(support.getReceiver());
return proxyController;
}
use of com.google.cloud.video.livestream.v1.Channel in project wildfly-core by wildfly.
the class RemoteChannelProxyControllerTestCase method createProxyController.
@Override
protected ProxyController createProxyController(final ModelController proxiedController, final PathAddress proxyNodeAddress) {
try {
channels = new RemoteChannelPairSetup();
channels.setupRemoting(new ManagementChannelInitialization() {
@Override
public ManagementChannelHandler startReceiving(Channel channel) {
final ManagementClientChannelStrategy strategy = ManagementClientChannelStrategy.create(channel);
final ManagementChannelHandler support = new ManagementChannelHandler(strategy, channels.getExecutorService());
support.addHandlerFactory(new TransactionalProtocolOperationHandler(proxiedController, support, new ResponseAttachmentInputStreamSupport()));
channel.addCloseHandler(new CloseHandler<Channel>() {
@Override
public void handleClose(Channel closed, IOException exception) {
support.shutdownNow();
}
});
channel.receiveMessage(support.getReceiver());
return support;
}
});
channels.startClientConnetion();
} catch (Exception e) {
throw new RuntimeException(e);
}
final Channel clientChannel = channels.getClientChannel();
final ManagementClientChannelStrategy strategy = ManagementClientChannelStrategy.create(clientChannel);
final ManagementChannelHandler support = new ManagementChannelHandler(strategy, channels.getExecutorService());
final RemoteProxyController proxyController = RemoteProxyController.create(support, proxyNodeAddress, ProxyOperationAddressTranslator.SERVER);
clientChannel.addCloseHandler(new CloseHandler<Channel>() {
@Override
public void handleClose(Channel closed, IOException exception) {
support.shutdownNow();
}
});
clientChannel.receiveMessage(support.getReceiver());
return proxyController;
}
use of com.google.cloud.video.livestream.v1.Channel in project wildfly-core by wildfly.
the class TransactionalProtocolClientTestCase method startChannelServer.
@Before
public void startChannelServer() throws Exception {
final ChannelServer.Configuration configuration = new ChannelServer.Configuration();
configuration.setEndpointName(ENDPOINT_NAME);
configuration.setUriScheme(URI_SCHEME);
configuration.setBindAddress(new InetSocketAddress("127.0.0.1", PORT));
channelServer = ChannelServer.create(configuration);
//
channelServer.addChannelOpenListener(TEST_CHANNEL, new OpenListener() {
@Override
public void channelOpened(final Channel channel) {
final MockController controller = new MockController();
final ManagementClientChannelStrategy strategy = ManagementClientChannelStrategy.create(channel);
final ManagementChannelHandler channels = new ManagementChannelHandler(strategy, remoteExecutors);
final ManagementRequestHandlerFactory handlerFactory = new TransactionalProtocolOperationHandler(controller, channels, new ResponseAttachmentInputStreamSupport());
channels.addHandlerFactory(handlerFactory);
transferQueue.offer(controller);
channel.addCloseHandler(channels);
channel.receiveMessage(channels.getReceiver());
}
@Override
public void registrationTerminated() {
//
}
});
final ProtocolConnectionConfiguration connectionConfig = ProtocolConnectionConfiguration.create(channelServer.getEndpoint(), new URI("" + URI_SCHEME + "://127.0.0.1:" + PORT + ""));
connectionConfig.setEndpoint(channelServer.getEndpoint());
//
futureConnection = connectionConfig.getEndpoint().getConnection(connectionConfig.getUri());
}
use of com.google.cloud.video.livestream.v1.Channel in project wildfly-core by wildfly.
the class TransactionalProtocolClientTestCase method createClient.
/**
* Create the protocol client to talk to the remote controller.
*
* @return the client
* @throws Exception
*/
TransactionalProtocolClient createClient() throws Exception {
final Connection connection = futureConnection.get();
final IoFuture<Channel> channelIoFuture = connection.openChannel(TEST_CHANNEL, OptionMap.EMPTY);
return createClient(channelIoFuture.get());
}
use of com.google.cloud.video.livestream.v1.Channel in project wildfly-core by wildfly.
the class TestControllerClient method executeAwaitClosed.
protected ModelNode executeAwaitClosed(final ModelNode operation) throws IOException {
final Channel channel = getChannelAssociation().getChannel();
final Connection connection = channel.getConnection();
final ModelNode result = execute(operation);
if (!ModelDescriptionConstants.SUCCESS.equals(result.get(ModelDescriptionConstants.OUTCOME).asString())) {
return result;
}
try {
connection.awaitClosed();
} catch (InterruptedException e) {
e.printStackTrace();
}
return result;
}
Aggregations