本文整理汇总了Java中com.intellij.util.net.NetUtils.isSniEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java NetUtils.isSniEnabled方法的具体用法?Java NetUtils.isSniEnabled怎么用?Java NetUtils.isSniEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.net.NetUtils
的用法示例。
在下文中一共展示了NetUtils.isSniEnabled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import com.intellij.util.net.NetUtils; //导入方法依赖的package包/类
@Override
public void apply() throws ConfigurationException {
if (myPanel.myUseSecureConnection.isSelected() && !NetUtils.isSniEnabled()) {
boolean tooOld = !SystemInfo.isJavaVersionAtLeast("1.7");
String message = IdeBundle.message(tooOld ? "update.sni.not.available.error" : "update.sni.disabled.error");
throw new ConfigurationException(message);
}
boolean wasEnabled = mySettings.isCheckNeeded();
mySettings.setCheckNeeded(myPanel.myCheckForUpdates.isSelected());
if (wasEnabled != mySettings.isCheckNeeded()) {
UpdateCheckerComponent checker = ApplicationManager.getApplication().getComponent(UpdateCheckerComponent.class);
if (checker != null) {
if (wasEnabled) {
checker.cancelChecks();
}
else {
checker.queueNextCheck();
}
}
}
mySettings.setUpdateChannelType(myPanel.getSelectedChannelType().getCode());
mySettings.setSecureConnection(myPanel.myUseSecureConnection.isSelected());
}
示例2: post
import com.intellij.util.net.NetUtils; //导入方法依赖的package包/类
private static HttpURLConnection post(URL url, byte[] bytes) throws IOException {
HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
connection.setSSLSocketFactory(ourSslContext.getSocketFactory());
if (!NetUtils.isSniEnabled()) {
connection.setHostnameVerifier(new EaHostnameVerifier());
}
connection.setRequestMethod("POST");
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=" + ENCODING);
connection.setRequestProperty("Content-Length", Integer.toString(bytes.length));
OutputStream out = connection.getOutputStream();
try {
out.write(bytes);
}
finally {
out.close();
}
return connection;
}
示例3: canUseSecureConnection
import com.intellij.util.net.NetUtils; //导入方法依赖的package包/类
public boolean canUseSecureConnection() {
return myState.SECURE_CONNECTION && NetUtils.isSniEnabled();
}