Tests: Fix InboundTest so it can be run without a real router

This commit is contained in:
zzz
2019-09-02 18:07:23 +00:00
parent 81ab35abe6
commit 566221b732
3 changed files with 97 additions and 52 deletions

View File

@@ -1,6 +1,7 @@
package net.i2p.router.tunnel;
import net.i2p.data.Hash;
import net.i2p.router.ProfileManager;
import net.i2p.router.RouterContext;
import net.i2p.util.Log;
import net.i2p.util.SimpleByteCache;
@@ -79,8 +80,13 @@ class InboundEndpointProcessor {
int rtt = 0; // dunno... may not be related to an rtt
if (_log.shouldLog(Log.DEBUG))
_log.debug("Received a " + length + "byte message through tunnel " + _config);
for (int i = 0; i < _config.getLength(); i++)
_context.profileManager().tunnelDataPushed(_config.getPeer(i), rtt, length);
ProfileManager pm = _context.profileManager();
// null for unit tests
if (pm != null) {
for (int i = 0; i < _config.getLength(); i++) {
pm.tunnelDataPushed(_config.getPeer(i), rtt, length);
}
}
_config.incrementVerifiedBytesTransferred(length);
}