org.eclipse.californium.core.network.Endpoint.start()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(157)

本文整理了Java中org.eclipse.californium.core.network.Endpoint.start()方法的一些代码示例,展示了Endpoint.start()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Endpoint.start()方法的具体详情如下:
包路径:org.eclipse.californium.core.network.Endpoint
类名称:Endpoint
方法名:start

Endpoint.start介绍

[英]Start this endpoint and all its components.. The starts its connector. If no executor has been set yet, the endpoint uses a single-threaded executor.
[中]启动此端点及其所有组件。。启动其连接器。如果尚未设置任何执行器,则端点将使用单线程执行器。

代码示例

代码示例来源:origin: eclipse/californium

private synchronized void createDefaultEndpoint() {
  if (default_endpoint != null)
    return;
  default_endpoint = new CoapEndpoint();
  try {
    default_endpoint.start();
    LOGGER.log(Level.INFO, "Created implicit default endpoint {0}", default_endpoint.getAddress());
  } catch (IOException e) {
    LOGGER.log(Level.SEVERE, "Could not create default endpoint", e);
  }
}

代码示例来源:origin: org.eclipse.californium/californium-core

private synchronized void createDefaultEndpoint() {
  if (default_endpoint != null) return;
  
  default_endpoint = new CoapEndpoint();
  
  try {
    default_endpoint.start();
    LOGGER.log(Level.INFO, "Created implicit default endpoint " + default_endpoint.getAddress());
  } catch (IOException e) {
    LOGGER.log(Level.SEVERE, "Could not create default endpoint", e);
  }
}

代码示例来源:origin: eclipse/californium

/**
 * Sets the endpoint this client is supposed to use.
 *
 * @param endpoint the endpoint
 * @return the CoAP client
 */
public CoapClient setEndpoint(Endpoint endpoint) {
      
  this.endpoint = endpoint;
  
  if (!endpoint.isStarted()) {
    try {
      endpoint.start();
      LOGGER.log(Level.INFO, "Started set client endpoint {0}", endpoint.getAddress());
    } catch (IOException e) {
      LOGGER.log(Level.SEVERE, "Could not set and start client endpoint", e);
    }
    
  }
  
  return this;
}

代码示例来源:origin: org.eclipse.californium/californium-core

/**
 * Sets the endpoint this client is supposed to use.
 *
 * @param endpoint the endpoint
 * @return the CoAP client
 */
public CoapClient setEndpoint(Endpoint endpoint) {
      
  this.endpoint = endpoint;
  
  if (!endpoint.isStarted()) {
    try {
      endpoint.start();
      LOGGER.log(Level.INFO, "Started set client endpoint " + endpoint.getAddress());
    } catch (IOException e) {
      LOGGER.log(Level.SEVERE, "Could not set and start client endpoint", e);
    }
    
  }
  
  return this;
}

代码示例来源:origin: org.eclipse.californium/californium-core

/**
 * Configures a new default secure endpoint. Any old default endpoint is destroyed.
 * @param endpoint the new default endpoint
 */
public void setDefaultSecureEndpoint(Endpoint endpoint) {
  if (this.default_secure_endpoint!=null) {
    this.default_secure_endpoint.destroy();
  }
  
  this.default_secure_endpoint = endpoint;
  if (!this.default_secure_endpoint.isStarted()) {
    try {
      default_secure_endpoint.start();
      LOGGER.log(Level.INFO, "Started new default secure endpoint " + default_secure_endpoint.getAddress());
    } catch (IOException e) {
      LOGGER.log(Level.SEVERE, "Could not start new default secure endpoint", e);
    }
  }
}

代码示例来源:origin: org.eclipse.californium/californium-core

/**
 * Configures a new default endpoint. Any old default endpoint is destroyed.
 * @param endpoint the new default endpoint
 */
public void setDefaultEndpoint(Endpoint endpoint) {
  
  if (this.default_endpoint!=null) {
    this.default_endpoint.destroy();
  }
  LOGGER.config(endpoint.getAddress()+" becomes default endpoint");
  
  this.default_endpoint = endpoint;
  
  if (!this.default_endpoint.isStarted()) {
    try {
      default_endpoint.start();
    } catch (IOException e) {
      LOGGER.log(Level.SEVERE, "Could not start new default endpoint", e);
    }
  }
}

代码示例来源:origin: eclipse/californium

/**
 * Configures a new default endpoint. Any old default endpoint is destroyed.
 * 
 * @param endpoint
 *            the new default endpoint
 */
public synchronized void setDefaultEndpoint(Endpoint endpoint) {
  if (this.default_endpoint != null) {
    this.default_endpoint.destroy();
  }
  LOGGER.log(Level.CONFIG, "{0} becomes default endpoint", endpoint.getAddress());
  this.default_endpoint = endpoint;
  if (!this.default_endpoint.isStarted()) {
    try {
      default_endpoint.start();
    } catch (IOException e) {
      LOGGER.log(Level.SEVERE, "Could not start new default endpoint", e);
    }
  }
}

代码示例来源:origin: eclipse/californium

/**
 * Configures a new default secure endpoint. Any old default endpoint is
 * destroyed.
 * 
 * @param endpoint
 *            the new default endpoint
 */
public synchronized void setDefaultSecureEndpoint(Endpoint endpoint) {
  if (this.default_secure_endpoint != null) {
    this.default_secure_endpoint.destroy();
  }
  this.default_secure_endpoint = endpoint;
  if (!this.default_secure_endpoint.isStarted()) {
    try {
      default_secure_endpoint.start();
      LOGGER.log(Level.INFO, "Started new default secure endpoint {0}", default_secure_endpoint.getAddress());
    } catch (IOException e) {
      LOGGER.log(Level.SEVERE, "Could not start new default secure endpoint", e);
    }
  }
}

代码示例来源:origin: eclipse/californium

/**
 * Configures a new secure tcp endpoint to use by default. Any old tcp
 * endpoint is destroyed.
 *
 * @param endpoint
 *            the new default secure tcp endpoint.
 */
public synchronized void setTcpEndpoint(Endpoint endpoint) {
  if (this.default_tcp_endpoint != null) {
    this.default_tcp_endpoint.destroy();
  }
  LOGGER.log(Level.CONFIG, "{0} becomes tcp endpoint", endpoint.getAddress());
  this.default_tcp_endpoint = endpoint;
  if (!this.default_tcp_endpoint.isStarted()) {
    try {
      default_tcp_endpoint.start();
    } catch (IOException e) {
      LOGGER.log(Level.SEVERE, "Could not start new tcp endpoint", e);
    }
  }
}

代码示例来源:origin: eclipse/californium

/**
 * Configures a new secure tcp endpoint to use by default. Any old tcp
 * endpoint is destroyed.
 *
 * @param endpoint
 *            the new default secure tcp endpoint.
 */
public synchronized void setSecureTcpEndpoint(Endpoint endpoint) {
  if (this.default_secure_tpc_endpoint != null) {
    this.default_secure_tpc_endpoint.destroy();
  }
  LOGGER.log(Level.CONFIG, "{0} becomes secure tcp endpoint", endpoint.getAddress());
  this.default_secure_tpc_endpoint = endpoint;
  if (!this.default_secure_tpc_endpoint.isStarted()) {
    try {
      default_secure_tpc_endpoint.start();
    } catch (IOException e) {
      LOGGER.log(Level.SEVERE, "Could not start new secure tcp endpoint", e);
    }
  }
}

代码示例来源:origin: org.eclipse.californium/californium-core

for (Endpoint ep:endpoints) {
  try {
    ep.start();

代码示例来源:origin: eclipse/californium

for (Endpoint ep : endpoints) {
  try {
    ep.start();

代码示例来源:origin: eclipse/californium

private synchronized void createTcpEndpoint() {
  if (default_tcp_endpoint != null)
    return;
  NetworkConfig config = NetworkConfig.getStandard();
  TcpClientConnector connector = new TcpClientConnector(config.getInt(NetworkConfig.Keys.TCP_WORKER_THREADS),
      config.getInt(NetworkConfig.Keys.TCP_CONNECT_TIMEOUT),
      config.getInt(NetworkConfig.Keys.TCP_CONNECTION_IDLE_TIMEOUT));
  default_tcp_endpoint = new CoapEndpoint(connector, config);
  try {
    default_tcp_endpoint.start();
    LOGGER.log(Level.INFO, "Created implicit tcp endpoint {0}", default_tcp_endpoint.getAddress());
  } catch (IOException e) {
    LOGGER.log(Level.SEVERE, "Could not create tcp endpoint", e);
  }
}

代码示例来源:origin: eclipse/californium

private synchronized void createSecureTcpEndpoint() {
  if (default_secure_tpc_endpoint != null)
    return;
  NetworkConfig config = NetworkConfig.getStandard();
  TlsClientConnector connector = new TlsClientConnector(config.getInt(NetworkConfig.Keys.TCP_WORKER_THREADS),
      config.getInt(NetworkConfig.Keys.TCP_CONNECT_TIMEOUT),
      config.getInt(NetworkConfig.Keys.TCP_CONNECTION_IDLE_TIMEOUT));
  default_secure_tpc_endpoint = new CoapEndpoint(connector, config);
  try {
    default_secure_tpc_endpoint.start();
    LOGGER.log(Level.INFO, "Created implicit secure tcp endpoint {0}",
        default_secure_tpc_endpoint.getAddress());
  } catch (IOException e) {
    LOGGER.log(Level.SEVERE, "Could not create secure tcp endpoint", e);
  }
}

代码示例来源:origin: eclipse/californium

@Before
public void createClient() throws IOException {
  clientEndpoint = new CoapEndpoint(config);
  clientEndpoint.start();
}

代码示例来源:origin: eclipse/californium.tools

dtlsEndpoint.start();
EndpointManager.getEndpointManager().setDefaultSecureEndpoint(dtlsEndpoint);

代码示例来源:origin: eclipse/californium

@Before
public void setupEndpoints() throws Exception {
  client = new CoapEndpoint(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), config);
  client.addInterceptor(clientInterceptor);
  client.start();
  System.out.println("Client binds to port " + client.getAddress().getPort());
  server = createLockstepEndpoint(client.getAddress());
}

代码示例来源:origin: eclipse/californium

@Before
public void setupEndpoints() throws Exception {
  //exchangeStore = new InMemoryMessageExchangeStore(CONFIG, new InMemoryRandomTokenProvider(CONFIG));
  // bind to loopback address using an ephemeral port
//	CoapEndpoint udpEndpoint = new CoapEndpoint(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), CONFIG, exchangeStore);
  client = new CoapEndpoint(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), CONFIG);
  client.addInterceptor(clientInterceptor);
  client.addInterceptor(new MessageTracer());
  client.start();
  System.out.println("Client binds to port " + client.getAddress().getPort());
  server = createLockstepEndpoint(client.getAddress());
}

代码示例来源:origin: eclipse/californium

@Before
public void setupServer() throws Exception {
  System.out.println(System.lineSeparator() + "Start " + getClass().getSimpleName());
  NetworkConfig config = network.createTestConfig()
    .setInt(NetworkConfig.Keys.MAX_MESSAGE_SIZE, 128)
    .setInt(NetworkConfig.Keys.PREFERRED_BLOCK_SIZE, 128)
    .setInt(NetworkConfig.Keys.ACK_TIMEOUT, 200) // client retransmits after 200 ms
    .setInt(NetworkConfig.Keys.ACK_RANDOM_FACTOR, 1);
  client = new CoapEndpoint(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), config);
  client.addInterceptor(new MessageTracer());
  client.start();
  clientPort = client.getAddress().getPort();
  server = createLockstepEndpoint(client.getAddress());
  System.out.println("Client binds to port " + clientPort);
}

代码示例来源:origin: eclipse/californium

clientEndpoint.start();

相关文章