org.fusesource.mqtt.client.MQTT.setSslContext()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(162)

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

MQTT.setSslContext介绍

暂无

代码示例

代码示例来源:origin: apache/storm

client.setSslContext(SslUtils.sslContext(uri.getScheme(), keyStoreLoader));

代码示例来源:origin: apache/activemq-artemis

@Override
public void setSslContext(SSLContext sslContext) {
 mqtt.setSslContext(sslContext);
}

代码示例来源:origin: com.sitewhere/sitewhere-core

tmf.init(ks);
  sslContext.init(null, tmf.getTrustManagers(), null);
  mqtt.setSslContext(sslContext);
  LOGGER.info("Created SSL context for MQTT receiver.");
} catch (Exception e) {

代码示例来源:origin: sitewhere/sitewhere

mqtt.setSslContext(sslContext);
  component.getLogger().info("Created SSL context for MQTT receiver.");
} catch (Throwable t) {

代码示例来源:origin: apache/activemq-artemis

private MQTT createMQTTSslConnection(String clientId, boolean clean) throws Exception {
 MQTT mqtt = new MQTT();
 mqtt.setConnectAttemptsMax(1);
 mqtt.setReconnectAttemptsMax(0);
 mqtt.setTracer(createTracer());
 mqtt.setHost("ssl://localhost:" + port);
 if (clientId != null) {
   mqtt.setClientId(clientId);
 }
 mqtt.setCleanSession(clean);
 SSLContext ctx = SSLContext.getInstance("TLS");
 ctx.init(new KeyManager[0], new TrustManager[]{new DefaultTrustManager()}, new SecureRandom());
 mqtt.setSslContext(ctx);
 return mqtt;
}

代码示例来源:origin: apache/activemq-artemis

private BlockingConnection retrieveMQTTConnection(String host, String truststorePath, String truststorePass, String keystorePath, String keystorePass) throws Exception {
 MQTT mqtt = new MQTT();
 mqtt.setConnectAttemptsMax(1);
 mqtt.setReconnectAttemptsMax(0);
 mqtt.setHost(host);
 SSLContext sslContext = new SSLSupport()
   .setKeystorePath(keystorePath)
   .setKeystorePassword(keystorePass)
   .setTruststorePath(truststorePath)
   .setTruststorePassword(truststorePass)
   .createContext();
 mqtt.setSslContext(sslContext);
 BlockingConnection connection = mqtt.blockingConnection();
 connection.connect();
 return connection;
}

相关文章