本文整理汇总了Java中org.eclipse.californium.core.CoapServer.start方法的典型用法代码示例。如果您正苦于以下问题:Java CoapServer.start方法的具体用法?Java CoapServer.start怎么用?Java CoapServer.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.californium.core.CoapServer
的用法示例。
在下文中一共展示了CoapServer.start方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.eclipse.californium.core.CoapServer; //导入方法依赖的package包/类
public List<Stage.ConfigIssue> init(Stage.Context context) {
List<Stage.ConfigIssue> issues = new ArrayList<>();
NetworkConfig networkConfig = NetworkConfig.createStandardWithoutFile();
networkConfig.set(NetworkConfig.Keys.DEDUPLICATOR, NetworkConfig.Keys.NO_DEDUPLICATOR);
networkConfig.set(NetworkConfig.Keys.PROTOCOL_STAGE_THREAD_COUNT, coAPServerConfigs.maxConcurrentRequests);
networkConfig.set(NetworkConfig.Keys.NETWORK_STAGE_RECEIVER_THREAD_COUNT, coAPServerConfigs.maxConcurrentRequests);
if (coAPServerConfigs.networkConfigs != null) {
for (String key: coAPServerConfigs.networkConfigs.keySet()) {
networkConfig.set(key, coAPServerConfigs.networkConfigs.get(key));
}
}
coapServer = new CoapServer(networkConfig, coAPServerConfigs.port);
coapReceiverResource = new CoapReceiverResource(context, receiver, errorQueue);
coapServer.add(coapReceiverResource);
coapServer.start();
return issues;
}
示例2: setUp
import org.eclipse.californium.core.CoapServer; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
int port = TestHttpClientTarget.getFreePort();
coapServer = new CoapServer(NetworkConfig.createStandardWithoutFile(), port);
coapServer.add(new CoapResource("test") {
@Override
public void handlePOST(CoapExchange exchange) {
serverRequested = true;
if (returnErrorResponse) {
exchange.respond(CoAP.ResponseCode.INTERNAL_SERVER_ERROR);
return;
}
requestPayload = new String(exchange.getRequestPayload());
exchange.respond(CoAP.ResponseCode.VALID);
}
});
resourceURl = "coap://localhost:" + port + "/test";
coapServer.start();
}
示例3: HTTPCoAPCrossProxy
import org.eclipse.californium.core.CoapServer; //导入方法依赖的package包/类
public HTTPCoAPCrossProxy() throws IOException {
ForwardingResource coap2coap = new ProxyCoapClientResource("coap2coap");
ForwardingResource coap2http = new ProxyHttpClientResource("coap2http");
// Create CoAP Server on PORT with proxy resources form CoAP to CoAP and HTTP
targetServerA = new CoapServer(PORT);
targetServerA.add(coap2coap);
targetServerA.add(coap2http);
//targetServerA.add(new TargetResource("target"));
targetServerA.start();
ProxyHttpServer httpServer = new ProxyHttpServer(8080);
httpServer.setProxyCoapResolver(new DirectProxyCoAPResolver(coap2coap));
System.out.println("CoAP resource \"target\" available over HTTP at: http://localhost:8080/proxy/coap://localhost:PORT/target");
}
示例4: main
import org.eclipse.californium.core.CoapServer; //导入方法依赖的package包/类
public static void main(String[] args) {
// binds on UDP port 5683
CoapServer server = new CoapServer();
// "hello"
server.add(new HelloResource());
// "subpath/Another"
CoapResource path = new CoapResource("subpath");
path.add(new AnotherResource());
server.add(path);
// "removeme!, "time", "writeme!"
server.add(new RemovableResource(), new TimeResource(), new WritableResource());
server.start();
}
示例5: setUp
import org.eclipse.californium.core.CoapServer; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
// start the server
server = Main.startServer();
// create the client
Client c = ClientBuilder.newClient();
// create a local CoAP server
CoapServer coap_server = new CoapServer();
coap_server.add(new HelloWorldResource());
// coap_server.addResource(new TimeResource());
coap_server.start();
target = c.target(Main.BASE_URI);
}
示例6: doStart
import org.eclipse.californium.core.CoapServer; //导入方法依赖的package包/类
@Override
protected void doStart() throws Exception {
super.doStart();
RestConfiguration config = getCamelContext().getRestConfiguration("coap", true);
// configure additional options on coap configuration
if (config.getComponentProperties() != null && !config.getComponentProperties().isEmpty()) {
setProperties(this, config.getComponentProperties());
}
defaultServer = getServer(config.getPort());
for (CoapServer s : servers.values()) {
s.start();
}
}
示例7: contextInitialized
import org.eclipse.californium.core.CoapServer; //导入方法依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent sce) {
// start the thread
System.out.println("intializing CoAP server");
System.out.println("context-path: " + sce.getServletContext().getContextPath());
System.out.println("real-path: " + sce.getServletContext().getRealPath(File.separator));
server = new CoapServer(5700);//deafult is 5683
server.setExecutor(Executors.newScheduledThreadPool(4));
//test
// server.add(new HelloWorldResource("hello"));
//Standard Operations
server.add(new CoapR01_ContextRegistration("ngsi9/registerContext"));
server.add(new CoapR02_Discovery("ngsi9/discoverContextAvailability"));
server.add(new CoapR03_AvailabilitySubscription("ngsi9/subscribeContextAvailability"));
server.add(new CoapR04_AvailabilitySubscriptionUpdate("ngsi9/updateContextAvailabilitySubscription"));
server.add(new CoapR05_AvailabilitySubscriptionDeletion("ngsi9/unsubscribeContextAvailability"));
//Convenience Operations
// server.add(new CoapRC01_Individual("ngsi9/contextEntities/{EntityID}"));
server.start();
}
示例8: main
import org.eclipse.californium.core.CoapServer; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, HL7Exception{
PCD01Msg = new PCD01();
D10404 = new Device10404();
D10407 = new Device10407();
D10408 = new Device10408();
D10415 = new Device10415();
D10417 = new Device10417();
D10420 = new Device10420();
D10472 = new Device10472();
D10404Resource d10404Resource = new D10404Resource("D10404_DIM", D10404);
D10404MeasurmentResource d10404MeasurmentResource = new D10404MeasurmentResource("D10404_Measurment", D10404);
D10404PCD01Resource d10404PCD01Resource = new D10404PCD01Resource("D10404_PCD01", PCD01Msg.getM_Parser10404());
D10407Resource d10407Resource = new D10407Resource("D10407_DIM", D10407);
D10407MeasurmentResource d10407MeasurmentResource = new D10407MeasurmentResource("D10407_Measurment", D10407);
D10407PCD01Resource d10407PCD01Resource = new D10407PCD01Resource("D10407_PCD01", PCD01Msg.getM_Parser10407());
D10408Resource d10408Resource = new D10408Resource("D10408_DIM", D10408);
D10408MeasurmentResource d10408MeasurmentResource = new D10408MeasurmentResource("D10408_Measurment", D10408);
D10408PCD01Resource d10408PCD01Resource = new D10408PCD01Resource("D10408_PCD01", PCD01Msg.getM_Parser10408());
D10415Resource d10415Resource = new D10415Resource("D10415_DIM", D10415);
D10415MeasurmentResource d10415MeasurmentResource = new D10415MeasurmentResource("D10415_Measurment", D10415);
D10415PCD01Resource d10415PCD01Resource = new D10415PCD01Resource("D10415_PCD01", PCD01Msg.getM_Parser10415());
D10417Resource d10417Resource = new D10417Resource("D10417_DIM", D10417);
D10417MeasurmentResource d10417MeasurmentResource = new D10417MeasurmentResource("D10417_Measurment", D10417);
D10417PCD01Resource d10417PCD01Resource = new D10417PCD01Resource("D10417_PCD01", PCD01Msg.getM_Parser10417());
D10420Resource d10420Resource = new D10420Resource("D10420_DIM", D10420);
D10420MeasurmentResource d10420MeasurmentResource = new D10420MeasurmentResource("D10420_Measurment", D10420);
D10420PCD01Resource d10420PCD01Resource = new D10420PCD01Resource("D10420_PCD01", PCD01Msg.getM_Parser10420());
D10472Resource d10472Resource = new D10472Resource("D10472_DIM", D10472);
D10472MeasurmentResource d10472MeasurmentResource = new D10472MeasurmentResource("D10472_Measurment", D10472);
D10472PCD01Resource d10472PCD01Resource = new D10472PCD01Resource("D10472_PCD01", PCD01Msg.getM_Parser10472());
CoapServer coapServer = new CoapServer();
d10404Resource.add(d10404MeasurmentResource);
d10404Resource.add(d10404PCD01Resource);
d10407Resource.add(d10407MeasurmentResource);
d10407Resource.add(d10407PCD01Resource);
d10408Resource.add(d10408MeasurmentResource);
d10408Resource.add(d10408PCD01Resource);
d10415Resource.add(d10415MeasurmentResource);
d10415Resource.add(d10415PCD01Resource);
d10417Resource.add(d10417MeasurmentResource);
d10417Resource.add(d10417PCD01Resource);
d10420Resource.add(d10420MeasurmentResource);
d10420Resource.add(d10420PCD01Resource);
d10472Resource.add(d10472MeasurmentResource);
d10472Resource.add(d10472PCD01Resource);
coapServer.add(d10404Resource.add(d10404MeasurmentResource));
coapServer.add(d10407Resource.add(d10407MeasurmentResource));
coapServer.add(d10408Resource.add(d10408MeasurmentResource));
coapServer.add(d10415Resource.add(d10415MeasurmentResource));
coapServer.add(d10417Resource.add(d10417MeasurmentResource));
coapServer.add(d10420Resource.add(d10420MeasurmentResource));
coapServer.add(d10472Resource.add(d10472MeasurmentResource));
coapServer.start();
process();
}
示例9: main
import org.eclipse.californium.core.CoapServer; //导入方法依赖的package包/类
public static void main(String[] args) {
// binds on UDP port 5683
CoapServer server = new CoapServer();
// "hello"
server.add(new HelloResource());
// TODO "subpath/Another"
// TODO "removeme!, "time", "writeme!"
server.start();
}
示例10: main
import org.eclipse.californium.core.CoapServer; //导入方法依赖的package包/类
public static void main(String[] args) {
// binds on UDP port 5683
CoapServer server = new CoapServer();
server.add(new HelloResource());
server.start();
}