Search in sources :

Example 1 with ManagementRequestHandlerFactory

use of org.jboss.as.protocol.mgmt.ManagementRequestHandlerFactory 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());
}
Also used : ManagementClientChannelStrategy(org.jboss.as.protocol.mgmt.ManagementClientChannelStrategy) ManagementChannelHandler(org.jboss.as.protocol.mgmt.ManagementChannelHandler) ProtocolConnectionConfiguration(org.jboss.as.protocol.ProtocolConnectionConfiguration) InetSocketAddress(java.net.InetSocketAddress) OpenListener(org.jboss.remoting3.OpenListener) Channel(org.jboss.remoting3.Channel) ResponseAttachmentInputStreamSupport(org.jboss.as.controller.remote.ResponseAttachmentInputStreamSupport) URI(java.net.URI) ChannelServer(org.jboss.as.controller.support.ChannelServer) ProtocolConnectionConfiguration(org.jboss.as.protocol.ProtocolConnectionConfiguration) TransactionalProtocolOperationHandler(org.jboss.as.controller.remote.TransactionalProtocolOperationHandler) ManagementRequestHandlerFactory(org.jboss.as.protocol.mgmt.ManagementRequestHandlerFactory) Before(org.junit.Before)

Aggregations

InetSocketAddress (java.net.InetSocketAddress)1 URI (java.net.URI)1 ResponseAttachmentInputStreamSupport (org.jboss.as.controller.remote.ResponseAttachmentInputStreamSupport)1 TransactionalProtocolOperationHandler (org.jboss.as.controller.remote.TransactionalProtocolOperationHandler)1 ChannelServer (org.jboss.as.controller.support.ChannelServer)1 ProtocolConnectionConfiguration (org.jboss.as.protocol.ProtocolConnectionConfiguration)1 ManagementChannelHandler (org.jboss.as.protocol.mgmt.ManagementChannelHandler)1 ManagementClientChannelStrategy (org.jboss.as.protocol.mgmt.ManagementClientChannelStrategy)1 ManagementRequestHandlerFactory (org.jboss.as.protocol.mgmt.ManagementRequestHandlerFactory)1 Channel (org.jboss.remoting3.Channel)1 OpenListener (org.jboss.remoting3.OpenListener)1 Before (org.junit.Before)1