Package ch.ethz.inf.vs.californium.server

Examples of ch.ethz.inf.vs.californium.server.Server


    public static void main(String[] args) {
       
        // create server
        try {
           
            Server server = new ResourceDirectory();
            server.start();
           
            System.out.printf(ResourceDirectory.class.getSimpleName()+" listening on port %d.\n", server.getEndpoints().get(0).getAddress().getPort());
           
        } catch (SocketException e) {
           
            System.err.printf("Failed to create "+ResourceDirectory.class.getSimpleName()+": %s\n", e.getMessage());
            System.exit(ERR_INIT_FAILED);
View Full Code Here


  public ProxyHttpCoAPServer() 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 Server(PORT);
    targetServerA.add(coap2coap);
    targetServerA.add(coap2http);
    targetServerA.add(new TargetResource("target"));
    targetServerA.start();
   
View Full Code Here

          return newServer(config, port);
        }

        @Override
        public ServerInterface newServer(NetworkConfig config, int... ports) {
          Server server = new Server(config, ports);
          return server;
        }
      };
    }
  }
View Full Code Here

   
    public static void main(String[] args) {
     
        // create server
        try {
            Server server = new PlugtestServer();
            // ETSI Plugtest environment
//            server.addEndpoint(new CoAPEndpoint(new InetSocketAddress("::1", port)));
//            server.addEndpoint(new CoAPEndpoint(new InetSocketAddress("127.0.0.1", port)));
//            server.addEndpoint(new CoAPEndpoint(new InetSocketAddress("2a01:c911:0:2010::10", port)));
//            server.addEndpoint(new CoAPEndpoint(new InetSocketAddress("10.200.1.2", port)));
           
            server.start();
           
            // add special interceptor for message traces
            for (Endpoint ep:server.getEndpoints()) {
              ep.addInterceptor(new MessageTracer());
            }
           
            System.out.println(PlugtestServer.class.getSimpleName()+" listening on port " + port);
           
View Full Code Here

   
   
    setBenchmarkConfiguration(udp_sender, udp_receiver, verbose);
   
    // Create server
    Server server = new Server();
    if (use_workers) {
      System.out.println("Use queues with "+endpoint_threads+" workers");
      server.setExecutor(new WorkQueueExecutor(endpoint_threads));
    } else {
      System.out.println("Endpoint thread-pool size: "+endpoint_threads);
      server.setExecutor(Executors.newScheduledThreadPool(endpoint_threads));
    }
    System.out.println("Number of receiver/sender threads: "+udp_receiver+"/"+udp_sender);
     
    server.add(new BenchmarkResource("benchmark"));
    server.add(new FibonacciResource("fibonacci"));
    server.add(new ShutDownResource("shutdown"));
   
    server.addEndpoint(new CoAPEndpoint(sockAddr));
    server.start();

    System.out.println("Benchmark server listening on " + sockAddr);
  }
View Full Code Here

* @author Martin Lanter
*/
public class ExampleServer {
 
  public static void main(String[] args) throws Exception {
    Server server = new Server();
    server.setExecutor(Executors.newScheduledThreadPool(4));
   
    server.add(new HelloWorldResource("hello"));
    server.add(new FibonacciResource("fibonacci"));
    server.add(new StorageResource("storage"));
    server.add(new ImageResource("image"));
    server.add(new MirrorResource("mirror"));
    server.add(new LargeResource("large"));
   
    server.start();
  }
View Full Code Here

    ScandiumLogger.setLevel(Level.FINER);
  }

  public static void main(String[] args) {
   
    Server server = new Server();
    server.add(new ResourceBase("secure") { 
        @Override
        public void handleGET(CoapExchange exchange) {
          exchange.respond(ResponseCode.CONTENT, "hello security");
        }
      });
        // ETSI Plugtest environment
//    server.addEndpoint(new CoAPEndpoint(new DTLSConnector(new InetSocketAddress("::1", DTLS_PORT)), NetworkConfig.getStandard()));
//    server.addEndpoint(new CoAPEndpoint(new DTLSConnector(new InetSocketAddress("127.0.0.1", DTLS_PORT)), NetworkConfig.getStandard()));
//    server.addEndpoint(new CoAPEndpoint(new DTLSConnector(new InetSocketAddress("2a01:c911:0:2010::10", DTLS_PORT)), NetworkConfig.getStandard()));
//    server.addEndpoint(new CoAPEndpoint(new DTLSConnector(new InetSocketAddress("10.200.1.2", DTLS_PORT)), NetworkConfig.getStandard()));
    server.addEndpoint(new CoAPEndpoint(new DTLSConnector(new InetSocketAddress(DTLS_PORT)), NetworkConfig.getStandard()));
    server.start();

        // add special interceptor for message traces
        for (Endpoint ep:server.getEndpoints()) {
          ep.addInterceptor(new MessageTracer());
        }
   
    System.out.println("Secure CoAP server powered by Scandium (Sc) is listening on port "+DTLS_PORT);
  }
View Full Code Here

TOP

Related Classes of ch.ethz.inf.vs.californium.server.Server

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.