Split transport identifiers into two: TransportId (globally unique)

and TransportIndex (locally unique).

This is the first step towards forward secrecy. Also removed the
Writable interface and unnecessary user-defined types, moved various
constants to ProtocolConstants and renamed some classes.
This commit is contained in:
akwizgran
2011-11-14 21:40:05 +00:00
parent 7d09102c4d
commit 73aa7d14d7
113 changed files with 1610 additions and 1121 deletions

View File

@@ -4,14 +4,11 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import junit.framework.TestCase;
import net.sf.briar.api.serial.Writable;
import net.sf.briar.api.serial.Writer;
import net.sf.briar.util.StringUtils;
import org.junit.Before;
@@ -284,20 +281,6 @@ public class WriterImplTest extends TestCase {
checkContents("EF" + "20" + "EF" + "FF");
}
@Test
public void testWriteCollectionOfWritables() throws IOException {
Writable writable = new Writable() {
public void writeTo(Writer w) throws IOException {
w.writeUserDefinedId(0);
w.writeString("foo");
}
};
w.writeList(Collections.singleton(writable));
// SHORT_LIST tag, length 1, SHORT_USER tag (3 bits), 0 (5 bits),
// "foo" as short string
checkContents("A" + "1" + "C0" + "83666F6F");
}
private void checkContents(String hex) throws IOException {
out.flush();
out.close();