common java socket_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

​點讚 3

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,

示例2: startServer

​點讚 3

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,

示例3: metaTest

​點讚 3

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,

示例4: dataTest

​點讚 3

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,

示例5: startServer

​點讚 2

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,

示例6: startServer

​點讚 2

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,

示例7: HttpMockServer

​點讚 2

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,

示例8: setUp

​點讚 2

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,

示例9: start

​點讚 2

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,

示例10: run

​點讚 2

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,

注:本文中的org.simpleframework.transport.connect.SocketConnection.connect方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
com.mongodb.MongoSocketOpenException: Exception opening socket at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70) ~[mongodb-driver-core-4.6.1.jar:na] at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:180) ~[mongodb-driver-core-4.6.1.jar:na] at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:193) ~[mongodb-driver-core-4.6.1.jar:na] at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:157) ~[mongodb-driver-core-4.6.1.jar:na] at java.lang.Thread.run(Thread.java:750) [na:1.8.0_371] Caused by: java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_371] at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:81) ~[na:1.8.0_371] at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:476) ~[na:1.8.0_371] at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:218) ~[na:1.8.0_371] at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:200) ~[na:1.8.0_371] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:162) ~[na:1.8.0_371] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:394) ~[na:1.8.0_371] at java.net.Socket.connect(Socket.java:606) ~[na:1.8.0_371] at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:107) ~[mongodb-driver-core-4.6.1.jar:na] at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:79) ~[mongodb-driver-core-4.6.1.jar:na] at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:65) ~[mongodb-driver-core-4.6.1.jar:na] ... 4 common frames omitted
最新发布
06-02
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值