当前位置: 首页>>代码示例>>Java>>正文


Java SocketConnection.connect方法代码示例

本文整理汇总了Java中org.simpleframework.transport.connect.SocketConnection.connect方法的典型用法代码示例。如果您正苦于以下问题:Java SocketConnection.connect方法的具体用法?Java SocketConnection.connect怎么用?Java SocketConnection.connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.simpleframework.transport.connect.SocketConnection的用法示例。


在下文中一共展示了SocketConnection.connect方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createServer

import org.simpleframework.transport.connect.SocketConnection; //导入方法依赖的package包/类
public static Connection createServer(boolean certificateRequired, int listenPort) throws Exception {
   System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
   System.setProperty("sun.security.ssl.allowLegacyHelloMessages", "true");
   File file = new File("C:\\work\\development\\async_http\\yieldbroker-proxy-trading\\etc\\uat.yieldbroker.com.pfx");
   KeyStoreReader reader = new KeyStoreReader(KeyStoreType.PKCS12, file, "p", "p");
   SecureSocketContext context = new SecureSocketContext(reader, SecureProtocol.TLS);
   SSLContext sslContext = context.getContext();
   Agent agent = new MockAgent();
   TransportProcessor processor = new TransportProcessor();
   ProcessorServer server = new ProcessorServer(processor);
   ConfigurableCertificateServer certServer = new ConfigurableCertificateServer(server);
   SocketConnection con = new SocketConnection(certServer, agent);
   SocketAddress serverAddress = new InetSocketAddress(listenPort);
   
   certServer.setCertRequired(certificateRequired);
   con.connect(serverAddress, sslContext);
   
   return con;
}
 
开发者ID:blobrobotics,项目名称:bstation,代码行数:20,代码来源:RenegotiationExample.java

示例2: startServer

import org.simpleframework.transport.connect.SocketConnection; //导入方法依赖的package包/类
/**
 * Will start the Server Mock as well as the RabbitMQ Listener
 * 
 * @throws IOException
 * @throws IguanaException
 * @throws TimeoutException
 */
@BeforeClass
public static void startServer() throws IOException, IguanaException, TimeoutException {
	// start ServerMock
	mock = new StresstestServerMock();
	fastServer = new ContainerServer(mock);
	fastConnection = new SocketConnection(fastServer);
	address1 = new InetSocketAddress(8024);
	fastConnection.connect(address1);
	// start RabbitMQ listener
	// queue declare
	ConnectionFactory factory = new ConnectionFactory();
	factory.setHost("localhost");
	connection = factory.newConnection();
	channel = connection.createChannel();

	channel.queueDeclare(COMMON.CORE2RP_QUEUE_NAME, false, false, false, null);
}
 
开发者ID:dice-group,项目名称:IGUANA,代码行数:25,代码来源:StresstestTest.java

示例3: metaTest

import org.simpleframework.transport.connect.SocketConnection; //导入方法依赖的package包/类
/**
 * @throws IOException
 */
@Test
public void metaTest() throws IOException{
	fastServerContainer = new ServerMock();
       fastServer = new ContainerServer(fastServerContainer);
       fastConnection = new SocketConnection(fastServer);
       SocketAddress address1 = new InetSocketAddress(FAST_SERVER_PORT);
       fastConnection.connect(address1);
       
       String host = "http://localhost:8023";
       TriplestoreStorage store = new TriplestoreStorage(host, host);
       Properties p = new Properties();
	p.put(COMMON.EXPERIMENT_TASK_ID_KEY, "1/1/1");
    p.setProperty(COMMON.EXPERIMENT_ID_KEY, "1/1");
    p.setProperty(COMMON.CONNECTION_ID_KEY, "virtuoso");
    p.setProperty(COMMON.SUITE_ID_KEY, "1");
    p.setProperty(COMMON.DATASET_ID_KEY, "dbpedia");
    p.put(COMMON.RECEIVE_DATA_START_KEY, "true");
    p.put(COMMON.EXTRA_META_KEY, new Properties());
    p.put(COMMON.NO_OF_QUERIES, 2);
       store.addMetaData(p);
       
       assertEquals(metaExp.trim(), fastServerContainer.getActualContent().trim());
}
 
开发者ID:dice-group,项目名称:IGUANA,代码行数:27,代码来源:TriplestoreStorageTest.java

示例4: dataTest

import org.simpleframework.transport.connect.SocketConnection; //导入方法依赖的package包/类
/**
 * @throws IOException
 */
@Test
public void dataTest() throws IOException{
	fastServerContainer = new ServerMock();
       fastServer = new ContainerServer(fastServerContainer);
       fastConnection = new SocketConnection(fastServer);
       SocketAddress address1 = new InetSocketAddress(FAST_SERVER_PORT);
       fastConnection.connect(address1);
       
       String host = "http://localhost:8023";
       TriplestoreStorage store = new TriplestoreStorage(host, host);
       Properties p = new Properties();
       p.setProperty(COMMON.EXPERIMENT_TASK_ID_KEY, "1/1/1");
    p.put(COMMON.METRICS_PROPERTIES_KEY, "testMetric");
    p.put(COMMON.EXTRA_META_KEY, new Properties());
       
       Triple[] t = new Triple[1];
    t[0] = new Triple("a", "b", "c");
    store.addData(p, t);
    store.commit();
       assertEquals(dataExp.trim(),fastServerContainer.getActualContent().trim());
}
 
开发者ID:dice-group,项目名称:IGUANA,代码行数:25,代码来源:TriplestoreStorageTest.java

示例5: startServer

import org.simpleframework.transport.connect.SocketConnection; //导入方法依赖的package包/类
@Before
public void startServer() throws IOException {
    server = new ContainerServer(container);
    connection = new SocketConnection(server);
    SocketAddress address = new InetSocketAddress(SERVER_PORT);
    connection.connect(address);
}
 
开发者ID:dice-group,项目名称:Squirrel,代码行数:8,代码来源:AbstractServerMockUsingTest.java

示例6: startServer

import org.simpleframework.transport.connect.SocketConnection; //导入方法依赖的package包/类
@Before
public void startServer() throws IOException {
    fastServerContainer = new WaitingDocumentReturningServerMock(DOCUMENTS, 0);
    fastServer = new ContainerServer(fastServerContainer);
    fastConnection = new SocketConnection(fastServer);
    SocketAddress address1 = new InetSocketAddress(FAST_SERVER_PORT);
    fastConnection.connect(address1);
    slowServer = new ContainerServer(new WaitingDocumentReturningServerMock(DOCUMENTS, SLOW_SERVER_WAITING_TIME));
    slowConnection = new SocketConnection(slowServer);
    SocketAddress address2 = new InetSocketAddress(SLOW_SERVER_PORT);
    slowConnection.connect(address2);
}
 
开发者ID:dice-group,项目名称:gerbil,代码行数:13,代码来源:HttpBasedAnnotatorTest.java

示例7: HttpMockServer

import org.simpleframework.transport.connect.SocketConnection; //导入方法依赖的package包/类
public HttpMockServer(@Nonnull JSONObject jsonObject, @Nonnull ConfigReader configReader, @Nonnull NetworkType simulatedNetworkType)
        throws IOException, JSONException {
    ConfigResult config = new ConfigParser(configReader).parseConfig(jsonObject);
    MockNetworkLag networkLag = new MockNetworkLag(simulatedNetworkType);
    this.responseHandler = new ResponseHandler(config.responses, networkLag, configReader);
    Server server = new ContainerServer(this);
    conn = new SocketConnection(server);
    final SocketAddress sa = new InetSocketAddress(config.port);
    conn.connect(sa);
}
 
开发者ID:byoutline,项目名称:MockServer,代码行数:11,代码来源:HttpMockServer.java

示例8: setUp

import org.simpleframework.transport.connect.SocketConnection; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
	Server server = new ContainerServer(testContainer);
	connection = new SocketConnection(server);
	
	ServerSocket socketServer = new ServerSocket(0);
	port = socketServer.getLocalPort();
	socketServer.close();
	
	connection.connect(new InetSocketAddress(port));
}
 
开发者ID:Kixeye,项目名称:relax,代码行数:12,代码来源:AsyncRestClientTest.java

示例9: start

import org.simpleframework.transport.connect.SocketConnection; //导入方法依赖的package包/类
public void start() throws IOException {
    
    server = new FixdServer(new ContainerServer(container));
    connection = new SocketConnection(server, new LoggingAgent());
    SocketAddress address = new InetSocketAddress(port);
    
    actualConnectionAddress = (InetSocketAddress)connection.connect(address);
}
 
开发者ID:lantunes,项目名称:fixd,代码行数:9,代码来源:ServerFixture.java

示例10: run

import org.simpleframework.transport.connect.SocketConnection; //导入方法依赖的package包/类
public void run(final Application app, SSLContext context) throws IOException {
    connection = new SocketConnection(new ContainerSocketProcessor(new ApplicationContainer(app), numberOfThreads));
    connection.connect(new InetSocketAddress(host, port), context);
}
 
开发者ID:testinfected,项目名称:molecule,代码行数:5,代码来源:SimpleServer.java


注:本文中的org.simpleframework.transport.connect.SocketConnection.connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。