本文整理汇总了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;
}
示例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);
}
示例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());
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}