本文整理汇总了Java中org.simpleframework.http.core.ContainerServer类的典型用法代码示例。如果您正苦于以下问题:Java ContainerServer类的具体用法?Java ContainerServer怎么用?Java ContainerServer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ContainerServer类属于org.simpleframework.http.core包,在下文中一共展示了ContainerServer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startServer
import org.simpleframework.http.core.ContainerServer; //导入依赖的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);
}
示例2: metaTest
import org.simpleframework.http.core.ContainerServer; //导入依赖的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());
}
示例3: dataTest
import org.simpleframework.http.core.ContainerServer; //导入依赖的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());
}
示例4: main
import org.simpleframework.http.core.ContainerServer; //导入依赖的package包/类
public static void main(String args[]) throws Exception {
// use port if given
try {
port = Integer.parseInt(args[0]);
} catch(Exception e) {
// silently keep port at 8080
}
// initialize the Stanford Core NLP
pipeline = new StanfordCoreNLP();
// start the server
Container container = new StanfordCoreNLPXMLServer();
Server server = new ContainerServer(container);
Connection connection = new SocketConnection(server);
SocketAddress address = new InetSocketAddress(port);
connection.connect(address);
log.info("Initialized server at port " + port + ".");
}
示例5: startServer
import org.simpleframework.http.core.ContainerServer; //导入依赖的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.http.core.ContainerServer; //导入依赖的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: init
import org.simpleframework.http.core.ContainerServer; //导入依赖的package包/类
@Override
public void init(DaemonContext dc) throws DaemonInitException, Exception {
log.info("initializing ...");
// Init ApiServer
container = new ApiServer();
server = new ContainerServer(container);
connection = new SocketConnection(server);
address = new InetSocketAddress(8082);
}
示例8: main
import org.simpleframework.http.core.ContainerServer; //导入依赖的package包/类
public static void main(String[] list) throws Exception {
Container container = new BlobStationServer();
Server server = new ContainerServer(container);
Connection connection = new SocketConnection(server);
SocketAddress address = new InetSocketAddress(8080);
connection.connect(address);
}
示例9: HttpMockServer
import org.simpleframework.http.core.ContainerServer; //导入依赖的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);
}
示例10: setUp
import org.simpleframework.http.core.ContainerServer; //导入依赖的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));
}
示例11: connect
import org.simpleframework.http.core.ContainerServer; //导入依赖的package包/类
public Connection connect() throws Exception {
Server server = new ContainerServer(this);
Connection connection = new SocketConnection(server);
SocketAddress address = new InetSocketAddress(port);
connection.connect(address);
return connection;
}
示例12: run
import org.simpleframework.http.core.ContainerServer; //导入依赖的package包/类
@Override
public void run() {
try {
Server server = new ContainerServer(this);
Connection connection = new SocketConnection(server);
SocketAddress address = new InetSocketAddress(port);
connection.connect(address);
} catch (IOException e) {
e.printStackTrace();
}
}
示例13: UPDATEWorkerTest
import org.simpleframework.http.core.ContainerServer; //导入依赖的package包/类
/**
* @throws IOException
*/
public UPDATEWorkerTest() throws IOException {
ServerMock mock = new ServerMock();
ContainerServer fastServer = new ContainerServer(mock);
fastConnection = new SocketConnection(fastServer);
address1 = new InetSocketAddress(8023);
}
示例14: start
import org.simpleframework.http.core.ContainerServer; //导入依赖的package包/类
public void start(){
org.simpleframework.transport.Server server;
try {
server = (org.simpleframework.transport.Server) new ContainerServer(reqHandler);
@SuppressWarnings("resource")
Connection connection = new SocketConnection(server);
SocketAddress address = new InetSocketAddress(port);
connection.connect(address);
System.out.println("Server runnung on port: "+port);
} catch (IOException e) {
e.printStackTrace();
}
}
示例15: start
import org.simpleframework.http.core.ContainerServer; //导入依赖的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);
}