List of usage examples for org.apache.thrift.transport TSSLTransportFactory getServerSocket
public static TServerSocket getServerSocket(int port, int clientTimeout, InetAddress ifAddress, TSSLTransportParameters params) throws TTransportException
From source file:JavaServer.java
License:Apache License
public static void secure(Calculator.Processor processor) { try {//from ww w . j a v a 2 s . c o m /* * Use TSSLTransportParameters to setup the required SSL parameters. In this example * we are setting the keystore and the keystore password. Other things like algorithms, * cipher suites, client auth etc can be set. */ TSSLTransportParameters params = new TSSLTransportParameters(); // The Keystore contains the private key params.setKeyStore("../../lib/java/test/.keystore", "thrift", null, null); /* * Use any of the TSSLTransportFactory to get a server transport with the appropriate * SSL configuration. You can use the default settings if properties are set in the command line. * Ex: -Djavax.net.ssl.keyStore=.keystore and -Djavax.net.ssl.keyStorePassword=thrift * * Note: You need not explicitly call open(). The underlying server socket is bound on return * from the factory class. */ TServerTransport serverTransport = TSSLTransportFactory.getServerSocket(9091, 0, null, params); TServer server = new TSimpleServer(new Args(serverTransport).processor(processor)); // Use this for a multi threaded server // TServer server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(processor)); System.out.println("Starting the secure server..."); server.serve(); } catch (Exception e) { e.printStackTrace(); } }
From source file:ap.main.java
License:Apache License
public static void secure(Calculator.Processor processor) { try {// w w w. j av a 2 s .c o m /* * Use TSSLTransportParameters to setup the required SSL parameters. In this example * we are setting the keystore and the keystore password. Other things like algorithms, * cipher suites, client auth etc can be set. */ TSSLTransportParameters params = new TSSLTransportParameters(); // The Keystore contains the private key params.setKeyStore("../../lib/java/test/.keystore", "thrift", null, null); /* * Use any of the TSSLTransportFactory to get a server transport with the appropriate * SSL configuration. You can use the default settings if properties are set in the command line. * Ex: -Djavax.net.ssl.keyStore=.keystore and -Djavax.net.ssl.keyStorePassword=thrift * * Note: You need not explicitly call open(). The underlying server socket is bound on return * from the factory class. */ TServerTransport serverTransport = TSSLTransportFactory.getServerSocket(9091, 0, null, params); TServer server = new TSimpleServer(new Args(serverTransport).processor(processor)); // Use this for a multi threaded server // TServer server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(processor)); System.out.println("Starting the secure server..."); server.serve(); } catch (Exception e) { e.printStackTrace(); } }
From source file:apache.JavaServer.java
License:Apache License
public static void secure(Calculator.Processor processor) { try {/*from www. j a v a2s .c o m*/ /* * Use TSSLTransportParameters to setup the required SSL parameters. * In this example we are setting the keystore and the keystore * password. Other things like algorithms, cipher suites, client * auth etc can be set. */ TSSLTransportParameters params = new TSSLTransportParameters(); // The Keystore contains the private key // params.setKeyStore("../../lib/java/test/.keystore", "thrift", // null, null); params.setKeyStore(JavaServer.class.getClass().getResource("/") + "key.keystore", "thrift", null, null); /* * Use any of the TSSLTransportFactory to get a server transport * with the appropriate SSL configuration. You can use the default * settings if properties are set in the command line. Ex: * -Djavax.net.ssl.keyStore=.keystore and * -Djavax.net.ssl.keyStorePassword=thrift * * Note: You need not explicitly call open(). The underlying server * socket is bound on return from the factory class. */ TServerTransport serverTransport = TSSLTransportFactory.getServerSocket(9091, 0, null, params); TServer server = new TSimpleServer(new Args(serverTransport).processor(processor)); // Use this for a multi threaded server // TServer server = new TThreadPoolServer(new // TThreadPoolServer.Args(serverTransport).processor(processor)); System.out.println("Starting the secure server..."); server.serve(); } catch (Exception e) { e.printStackTrace(); } }
From source file:club.jmint.mifty.server.MiftyServer.java
License:Apache License
private void secure(TMultiplexedProcessor p) { try {// ww w . ja va 2 s .c om TSSLTransportParameters params = new TSSLTransportParameters(); params.setKeyStore(keystore, "thrift", null, null); TServerTransport serverTransport = TSSLTransportFactory.getServerSocket(sslport, 0, null, params); //TServer server = new TSimpleServer(new Args(serverTransport).processor(processor)); // Use this for a multi threaded server TServer sslserver = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(p)); CrossLog.logger.info("Starting " + name + " secure server..."); sslserver.serve(); } catch (Exception e) { cleanup(); CrossLog.logger.error(name + " server startup failed."); CrossLog.printStackTrace(e); } }
From source file:com.an.antry.JavaServer.java
License:Apache License
public static void secure(Calculator.Processor processor) { try {// www .j a v a 2 s .co m /* * Use TSSLTransportParameters to setup the required SSL parameters. In this example we are setting the * keystore and the keystore password. Other things like algorithms, cipher suites, client auth etc can be * set. */ TSSLTransportParameters params = new TSSLTransportParameters(); // The Keystore contains the private key params.setKeyStore("../../lib/java/test/.keystore", "thrift", null, null); /* * Use any of the TSSLTransportFactory to get a server transport with the appropriate SSL configuration. You * can use the default settings if properties are set in the command line. Ex: * -Djavax.net.ssl.keyStore=.keystore and -Djavax.net.ssl.keyStorePassword=thrift * * Note: You need not explicitly call open(). The underlying server socket is bound on return from the * factory class. */ TServerTransport serverTransport = TSSLTransportFactory.getServerSocket(9091, 0, null, params); TServer server = new TSimpleServer(new Args(serverTransport).processor(processor)); // Use this for a multi threaded server // TServer server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(processor)); System.out.println("Starting the secure server..."); server.serve(); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.anteam.demo.thrift.server.JavaServer.java
License:Apache License
public static void secure(Calculator.Processor<Calculator.Iface> processor) { try {/*from w ww. j a v a 2s . c om*/ /* * Use TSSLTransportParameters to setup the required SSL parameters. In this example * we are setting the keystore and the keystore password. Other things like algorithms, * cipher suites, client auth etc can be set. */ TSSLTransportParameters params = new TSSLTransportParameters(); // The Keystore contains the private key params.setKeyStore("../../lib/java/test/.keystore", "thrift", null, null); /* * Use any of the TSSLTransportFactory to get a server transport with the appropriate * SSL configuration. You can use the default settings if properties are set in the command line. * Ex: -Djavax.net.ssl.keyStore=.keystore and -Djavax.net.ssl.keyStorePassword=thrift * * Note: You need not explicitly call open(). The underlying server socket is bound on return * from the factory class. */ TServerTransport serverTransport = TSSLTransportFactory.getServerSocket(9091, 0, null, params); TServer server = new TSimpleServer(new Args(serverTransport).processor(processor)); // Use this for a multi threaded server // TServer server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(processor)); System.out.println("Starting the secure server..."); server.serve(); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.fjn.helper.frameworkex.apache.thrift.TestServer.java
License:Apache License
public static void secure(Calculator.Processor processor) { try {/*w w w . j a v a2 s. c o m*/ /* * Use TSSLTransportParameters to setup the required SSL parameters. * In this example we are setting the keystore and the keystore * password. Other things like algorithms, cipher suites, client * auth etc can be set. */ TSSLTransportParameters params = new TSSLTransportParameters(); // The Keystore contains the private key params.setKeyStore("com/fjn/frame/apache/thrift/.keystore", "thrift", null, null); /* * Use any of the TSSLTransportFactory to get a server transport * with the appropriate SSL configuration. You can use the default * settings if properties are set in the command line. Ex: * -Djavax.net.ssl.keyStore=.keystore and * -Djavax.net.ssl.keyStorePassword=thrift * * Note: You need not explicitly call open(). The underlying server * socket is bound on return from the factory class. */ TServerTransport serverTransport = TSSLTransportFactory.getServerSocket(9091, 0, null, params); TServer server = new TSimpleServer(new TServer.Args(serverTransport).processor(processor)); // Use this for a multi threaded server // TServer server = new TThreadPoolServer(new // TThreadPoolServer.Args(serverTransport).processor(processor)); System.out.println("Starting the secure server..."); server.serve(); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.github.katsurakkkk.thrift.JavaServer.java
License:Apache License
public static void secure(Calculator.Processor processor) { try {//from www .j a v a2 s . c o m /* * Use TSSLTransportParameters to setup the required SSL parameters. In this example * we are setting the keystore and the keystore password. Other things like algorithms, * cipher suites, client auth etc can be set. */ TSSLTransportParameters params = new TSSLTransportParameters(); // The Keystore contains the private key params.setKeyStore("src/main/resources/thrift/java.keystore", "thrift", null, null); /* * Use any of the TSSLTransportFactory to get a server transport with the appropriate * SSL configuration. You can use the default settings if properties are set in the command line. * Ex: -Djavax.net.ssl.keyStore=.keystore and -Djavax.net.ssl.keyStorePassword=thrift * * Note: You need not explicitly call open(). The underlying server socket is bound on return * from the factory class. */ TServerTransport serverTransport = TSSLTransportFactory.getServerSocket(9091, 0, null, params); TServer server = new TSimpleServer(new Args(serverTransport).processor(processor)); // Use this for a multi threaded server // TServer server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(processor)); System.out.println("Starting the secure server..."); server.serve(); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.jason.thrift.Server.java
License:Apache License
public static void secure(Transmit.Processor processor) { try {/* ww w . j a va2s.c o m*/ /* * Use TSSLTransportParameters to setup the required SSL parameters. In this example * we are setting the keystore and the keystore password. Other things like algorithms, * cipher suites, client auth etc can be set. */ TSSLTransportParameters params = new TSSLTransportParameters(); // The Keystore contains the private key params.setKeyStore("../../lib/java/test/.keystore", "thrift", null, null); /* * Use any of the TSSLTransportFactory to get a server transport with the appropriate * SSL configuration. You can use the default settings if properties are set in the command line. * Ex: -Djavax.net.ssl.keyStore=.keystore and -Djavax.net.ssl.keyStorePassword=thrift * * Note: You need not explicitly call open(). The underlying server socket is bound on return * from the factory class. */ TServerTransport serverTransport = TSSLTransportFactory.getServerSocket(9091, 0, null, params); TServer server = new TSimpleServer(new Args(serverTransport).processor(processor)); // Use this for a multi threaded server // TServer server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(processor)); System.out.println("Starting the secure server..."); server.serve(); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.odap.server.audit.AuditServer.java
License:Open Source License
public static void configServer(Config.Processor cp, String iname) { try {//from w ww.j av a 2 s.c o m TSSLTransportFactory.TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters(); params.setKeyStore("keystore.jks", keystore_password); TServerSocket serverTransport_config = TSSLTransportFactory.getServerSocket(7912, 10000, InetAddress.getByName(iname), params); TServer server_config = new TThreadPoolServer( new TThreadPoolServer.Args(serverTransport_config).processor(config_processor)); logger.info("Starting server on port 7912 ..."); server_config.serve(); } catch (Exception e) { e.printStackTrace(); } }