forked from I2P_Developers/i2p.i2p
unit test fixes
This commit is contained in:
@ -15,6 +15,7 @@ import net.i2p.data.PublicKey;
|
|||||||
import net.i2p.data.TunnelId;
|
import net.i2p.data.TunnelId;
|
||||||
import net.i2p.data.i2np.BuildRequestRecord;
|
import net.i2p.data.i2np.BuildRequestRecord;
|
||||||
import net.i2p.data.i2np.BuildResponseRecord;
|
import net.i2p.data.i2np.BuildResponseRecord;
|
||||||
|
import net.i2p.data.i2np.EncryptedBuildRecord;
|
||||||
import net.i2p.data.i2np.TunnelBuildMessage;
|
import net.i2p.data.i2np.TunnelBuildMessage;
|
||||||
import net.i2p.data.i2np.TunnelBuildReplyMessage;
|
import net.i2p.data.i2np.TunnelBuildReplyMessage;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
@ -87,11 +88,11 @@ public class BuildMessageTestStandalone extends TestCase {
|
|||||||
long now = (ctx.clock().now() / (60l*60l*1000l)) * (60*60*1000);
|
long now = (ctx.clock().now() / (60l*60l*1000l)) * (60*60*1000);
|
||||||
int ourSlot = -1;
|
int ourSlot = -1;
|
||||||
|
|
||||||
byte reply[] = BuildResponseRecord.create(ctx, 0, req.readReplyKey(), req.readReplyIV(), -1);
|
EncryptedBuildRecord reply = BuildResponseRecord.create(ctx, 0, req.readReplyKey(), req.readReplyIV(), -1);
|
||||||
for (int j = 0; j < TunnelBuildMessage.MAX_RECORD_COUNT; j++) {
|
for (int j = 0; j < TunnelBuildMessage.MAX_RECORD_COUNT; j++) {
|
||||||
if (msg.getRecord(j) == null) {
|
if (msg.getRecord(j) == null) {
|
||||||
ourSlot = j;
|
ourSlot = j;
|
||||||
msg.setRecord(j, new ByteArray(reply));
|
msg.setRecord(j, reply);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,7 +174,7 @@ public class BuildMessageTestStandalone extends TestCase {
|
|||||||
hop.setReplyKey(ctx.keyGenerator().generateSessionKey());
|
hop.setReplyKey(ctx.keyGenerator().generateSessionKey());
|
||||||
byte iv[] = new byte[BuildRequestRecord.IV_SIZE];
|
byte iv[] = new byte[BuildRequestRecord.IV_SIZE];
|
||||||
Arrays.fill(iv, (byte)i); // consistent for repeatability
|
Arrays.fill(iv, (byte)i); // consistent for repeatability
|
||||||
hop.setReplyIV(new ByteArray(iv));
|
hop.setReplyIV(iv);
|
||||||
hop.setReceiveTunnelId(new TunnelId(i+1));
|
hop.setReceiveTunnelId(new TunnelId(i+1));
|
||||||
}
|
}
|
||||||
return cfg;
|
return cfg;
|
||||||
|
Reference in New Issue
Block a user