MLab: Switch to name server that supports SSL

swingemu cleanups
This commit is contained in:
zzz
2018-11-16 17:12:32 +00:00
parent 9a254aec55
commit 9b9810ea1e
3 changed files with 14 additions and 12 deletions

View File

@ -38,6 +38,7 @@ import net.minidev.json.parser.ParseException;
import net.i2p.I2PAppContext; import net.i2p.I2PAppContext;
import net.i2p.data.DataHelper; import net.i2p.data.DataHelper;
import net.i2p.util.EepGet; import net.i2p.util.EepGet;
import net.i2p.util.SSLEepGet;
import net.i2p.util.I2PAppThread; import net.i2p.util.I2PAppThread;
import net.i2p.util.Log; import net.i2p.util.Log;
@ -49,9 +50,9 @@ import net.i2p.util.Log;
public class MLabRunner { public class MLabRunner {
// ns.measurementlab.net does not support https // ns.measurementlab.net does not support https
// use ndt_ssl for test over ssl? but Tcpbw100 doesn't support it // use ndt_ssl for test over ssl? but Tcpbw100 doesn't support it
private static final String NS_URL = "http://ns.measurementlab.net/ndt?format=json"; //private static final String NS_URL = "http://ns.measurementlab.net/ndt?format=json";
private static final String NS_URL_SSL = "https://mlab-ns.appspot.com/ndt?format=json";
private static final long NS_TIMEOUT = 20*1000; private static final long NS_TIMEOUT = 20*1000;
private boolean test_active;
private final I2PAppContext _context; private final I2PAppContext _context;
private final Log _log; private final Log _log;
private final AtomicBoolean _running = new AtomicBoolean(); private final AtomicBoolean _running = new AtomicBoolean();
@ -119,9 +120,10 @@ public class MLabRunner {
// public EepGet(I2PAppContext ctx, boolean shouldProxy, String proxyHost, int proxyPort, // public EepGet(I2PAppContext ctx, boolean shouldProxy, String proxyHost, int proxyPort,
// int numRetries, long minSize, long maxSize, String outputFile, OutputStream outputStream, // int numRetries, long minSize, long maxSize, String outputFile, OutputStream outputStream,
// String url, boolean allowCaching, String etag, String postData) { // String url, boolean allowCaching, String etag, String postData) {
EepGet eepget = new EepGet(_context, false, null, 0, //EepGet eepget = new EepGet(_context, false, null, 0,
0, 2, 1024, null, baos, // 0, 2, 1024, null, baos,
NS_URL, false, null, null); // NS_URL, false, null, null);
EepGet eepget = new SSLEepGet(_context, baos, NS_URL_SSL);
boolean ok = eepget.fetch(NS_TIMEOUT, NS_TIMEOUT, NS_TIMEOUT); boolean ok = eepget.fetch(NS_TIMEOUT, NS_TIMEOUT, NS_TIMEOUT);
if (!ok) if (!ok)
throw new IOException("ns fetch failed"); throw new IOException("ns fetch failed");

View File

@ -33,7 +33,7 @@ JTextArea
extends Component extends Component
{ {
private final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(Tcpbw100.class); private final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(Tcpbw100.class);
private String text = ""; private final StringBuilder text = new StringBuilder();
public public
JTextArea( JTextArea(
@ -41,7 +41,7 @@ JTextArea
int a, int a,
int b ) int b )
{ {
text = str; text.append(str);
} }
public void public void
@ -50,13 +50,13 @@ JTextArea
{ {
if (_log.shouldWarn()) if (_log.shouldWarn())
_log.warn(str.trim()); _log.warn(str.trim());
text += str; text.append(str);
} }
public String public String
getText() getText()
{ {
return( text ); return text.toString();
} }
public void public void

View File

@ -32,12 +32,12 @@ public class
StyledDocument StyledDocument
{ {
private final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(Tcpbw100.class); private final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(Tcpbw100.class);
public String str = ""; private final StringBuilder text = new StringBuilder();
public int public int
getLength() getLength()
{ {
return( str.length()); return text.length();
} }
public void public void
@ -50,6 +50,6 @@ StyledDocument
{ {
if (_log.shouldWarn()) if (_log.shouldWarn())
_log.warn(s.trim()); _log.warn(s.trim());
str += s; text.append(s);
} }
} }