Java Code Examples for org.xnio.Xnio#getInstance()
The following examples show how to use
org.xnio.Xnio#getInstance() .
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: ProgrammaticWebSocketServer.java From wildfly-samples with MIT License | 9 votes |
public ProgrammaticWebSocketServer() throws IOException { final Xnio xnio = Xnio.getInstance("nio", Undertow.class.getClassLoader()); final XnioWorker xnioWorker = xnio.createWorker(OptionMap.builder().getMap()); WebSocketDeploymentInfo websocket = new WebSocketDeploymentInfo() .addEndpoint(MyAnnotatedEndpoint.class) .setWorker(xnioWorker); DeploymentInfo deploymentInfo = deployment() .setClassLoader(MyAnnotatedEndpoint.class.getClassLoader()) .setContextPath("/myapp") .setDeploymentName("websockets") .addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, websocket); manager = defaultContainer().addDeployment(deploymentInfo); manager.deploy(); }
Example 2
Source File: AnnotatedWebSocketServer.java From wildfly-samples with MIT License | 7 votes |
public AnnotatedWebSocketServer() throws IOException { final Xnio xnio = Xnio.getInstance("nio", Undertow.class.getClassLoader()); final XnioWorker xnioWorker = xnio.createWorker(OptionMap.builder().getMap()); WebSocketDeploymentInfo websocket = new WebSocketDeploymentInfo() .addEndpoint(MyAnnotatedEndpoint.class) .setWorker(xnioWorker); DeploymentInfo deploymentInfo = deployment() .setClassLoader(MyAnnotatedEndpoint.class.getClassLoader()) .setContextPath("/myapp") .setDeploymentName("websockets") .addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, websocket); manager = defaultContainer().addDeployment(deploymentInfo); manager.deploy(); }
Example 3
Source File: JBoss.java From ysoserial-modified with MIT License | 5 votes |
public ConnectionProviderContextImpl ( OptionMap opts, String endpointName ) throws IllegalArgumentException, IOException { this.instance = Xnio.getInstance(); this.worker = this.instance.createWorker(opts); this.endpoint = Remoting.createEndpoint(endpointName, this.worker, opts); this.executor = Executors.newCachedThreadPool(new ThreadFactory() { public Thread newThread ( Runnable r ) { Thread t = new Thread(r, "Worker"); t.setDaemon(true); return t; } }); }
Example 4
Source File: JBoss.java From ysoserial with MIT License | 5 votes |
public ConnectionProviderContextImpl ( OptionMap opts, String endpointName ) throws IllegalArgumentException, IOException { this.instance = Xnio.getInstance(); this.worker = this.instance.createWorker(opts); this.endpoint = Remoting.createEndpoint(endpointName, this.worker, opts); this.executor = Executors.newCachedThreadPool(new ThreadFactory() { public Thread newThread ( Runnable r ) { Thread t = new Thread(r, "Worker"); t.setDaemon(true); return t; } }); }
Example 5
Source File: TokenAuthenticator.java From hawkular-metrics with Apache License 2.0 | 5 votes |
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 6
Source File: ClassProviderStarter.java From websocket-classloader with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws IOException, ServletException { final Xnio xnio = Xnio.getInstance("nio", Undertow.class.getClassLoader()); final XnioWorker xnioWorker = xnio.createWorker(OptionMap.builder().getMap()); final WebSocketDeploymentInfo webSockets = new WebSocketDeploymentInfo() .addEndpoint(ClassProvider.class) .setWorker(xnioWorker); final DeploymentManager deploymentManager = Servlets.defaultContainer() .addDeployment(Servlets.deployment() .setClassLoader(ClassProviderStarter.class.getClassLoader()) .setContextPath("/") .setDeploymentName("class-provider") .addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, webSockets)); deploymentManager.deploy(); //noinspection deprecation Undertow.builder() .addListener(5000, "localhost") .setHandler(deploymentManager.start()) .build() .start(); }
Example 7
Source File: SNICombinedWithALPNTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private XnioSsl createClientSSL(File hostNameKeystore) throws NoSuchAlgorithmException, KeyStoreException, IOException, CertificateException, UnrecoverableKeyException, KeyManagementException { SSLContext clientContext = SSLContext.getInstance("TLS"); KeyStore store = KeyStore.getInstance("jks"); try (FileInputStream in = new FileInputStream(hostNameKeystore)) { store.load(in, PASSWORD.toCharArray()); } KeyManagerFactory km = KeyManagerFactory.getInstance(keyAlgorithm()); km.init(store, PASSWORD.toCharArray()); TrustManagerFactory tm = TrustManagerFactory.getInstance(keyAlgorithm()); tm.init(store); clientContext.init(km.getKeyManagers(), tm.getTrustManagers(), new SecureRandom()); return new UndertowXnioSsl(Xnio.getInstance(), OptionMap.EMPTY, clientContext); }
Example 8
Source File: ManagementWorkerService.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void start(StartContext startContext) throws StartException { final Xnio xnio = Xnio.getInstance(); try { worker = xnio.createWorker(null, options, this::stopDone); } catch (IOException e) { throw new StartException(e); } }