mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Refactoring: moved high-level connection classes to protocol package.
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
package net.sf.briar.api.transport;
|
||||
package net.sf.briar.api.protocol.batch;
|
||||
|
||||
import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.protocol.TransportIndex;
|
||||
import net.sf.briar.api.transport.BatchTransportReader;
|
||||
import net.sf.briar.api.transport.BatchTransportWriter;
|
||||
import net.sf.briar.api.transport.ConnectionContext;
|
||||
|
||||
public interface BatchConnectionFactory {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package net.sf.briar.api.transport;
|
||||
package net.sf.briar.api.protocol.stream;
|
||||
|
||||
import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.protocol.TransportIndex;
|
||||
import net.sf.briar.api.transport.ConnectionContext;
|
||||
import net.sf.briar.api.transport.StreamTransportConnection;
|
||||
|
||||
public interface StreamConnectionFactory {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.sf.briar.transport.batch;
|
||||
package net.sf.briar.protocol.batch;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
@@ -9,7 +9,7 @@ import net.sf.briar.api.protocol.ProtocolReaderFactory;
|
||||
import net.sf.briar.api.protocol.ProtocolWriterFactory;
|
||||
import net.sf.briar.api.protocol.TransportIndex;
|
||||
import net.sf.briar.api.protocol.VerificationExecutor;
|
||||
import net.sf.briar.api.transport.BatchConnectionFactory;
|
||||
import net.sf.briar.api.protocol.batch.BatchConnectionFactory;
|
||||
import net.sf.briar.api.transport.BatchTransportReader;
|
||||
import net.sf.briar.api.transport.BatchTransportWriter;
|
||||
import net.sf.briar.api.transport.ConnectionContext;
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.sf.briar.transport.batch;
|
||||
package net.sf.briar.protocol.batch;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.sf.briar.transport.batch;
|
||||
package net.sf.briar.protocol.batch;
|
||||
|
||||
import static net.sf.briar.api.protocol.ProtocolConstants.MAX_PACKET_LENGTH;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package net.sf.briar.transport.batch;
|
||||
package net.sf.briar.protocol.batch;
|
||||
|
||||
import net.sf.briar.api.transport.BatchConnectionFactory;
|
||||
import net.sf.briar.api.protocol.batch.BatchConnectionFactory;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
public class TransportBatchModule extends AbstractModule {
|
||||
public class ProtocolBatchModule extends AbstractModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.sf.briar.transport.stream;
|
||||
package net.sf.briar.protocol.stream;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.Executor;
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.sf.briar.transport.stream;
|
||||
package net.sf.briar.protocol.stream;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.Executor;
|
||||
@@ -1,11 +1,11 @@
|
||||
package net.sf.briar.transport.stream;
|
||||
package net.sf.briar.protocol.stream;
|
||||
|
||||
import net.sf.briar.api.transport.StreamConnectionFactory;
|
||||
import net.sf.briar.api.protocol.stream.StreamConnectionFactory;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
public class TransportStreamModule extends AbstractModule {
|
||||
public class ProtocolStreamModule extends AbstractModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.sf.briar.transport.stream;
|
||||
package net.sf.briar.protocol.stream;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.sf.briar.transport.stream;
|
||||
package net.sf.briar.protocol.stream;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
@@ -9,10 +9,10 @@ import net.sf.briar.api.protocol.ProtocolReaderFactory;
|
||||
import net.sf.briar.api.protocol.ProtocolWriterFactory;
|
||||
import net.sf.briar.api.protocol.TransportIndex;
|
||||
import net.sf.briar.api.protocol.VerificationExecutor;
|
||||
import net.sf.briar.api.protocol.stream.StreamConnectionFactory;
|
||||
import net.sf.briar.api.transport.ConnectionContext;
|
||||
import net.sf.briar.api.transport.ConnectionReaderFactory;
|
||||
import net.sf.briar.api.transport.ConnectionWriterFactory;
|
||||
import net.sf.briar.api.transport.StreamConnectionFactory;
|
||||
import net.sf.briar.api.transport.StreamTransportConnection;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
@@ -9,14 +9,14 @@ import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.db.DbException;
|
||||
import net.sf.briar.api.protocol.TransportId;
|
||||
import net.sf.briar.api.protocol.TransportIndex;
|
||||
import net.sf.briar.api.transport.BatchConnectionFactory;
|
||||
import net.sf.briar.api.protocol.batch.BatchConnectionFactory;
|
||||
import net.sf.briar.api.protocol.stream.StreamConnectionFactory;
|
||||
import net.sf.briar.api.transport.BatchTransportReader;
|
||||
import net.sf.briar.api.transport.BatchTransportWriter;
|
||||
import net.sf.briar.api.transport.ConnectionContext;
|
||||
import net.sf.briar.api.transport.ConnectionDispatcher;
|
||||
import net.sf.briar.api.transport.ConnectionRecogniser;
|
||||
import net.sf.briar.api.transport.ConnectionRecogniser.Callback;
|
||||
import net.sf.briar.api.transport.StreamConnectionFactory;
|
||||
import net.sf.briar.api.transport.StreamTransportConnection;
|
||||
import net.sf.briar.api.transport.TransportConstants;
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<test name='net.sf.briar.protocol.ProtocolWriterImplTest'/>
|
||||
<test name='net.sf.briar.protocol.RequestReaderTest'/>
|
||||
<test name='net.sf.briar.protocol.UnverifiedBatchImplTest'/>
|
||||
<test name='net.sf.briar.protocol.batch.BatchConnectionReadWriteTest'/>
|
||||
<test name='net.sf.briar.serial.ReaderImplTest'/>
|
||||
<test name='net.sf.briar.serial.WriterImplTest'/>
|
||||
<test name='net.sf.briar.setup.SetupWorkerTest'/>
|
||||
@@ -55,7 +56,6 @@
|
||||
<test name='net.sf.briar.transport.ConnectionWriterImplTest'/>
|
||||
<test name='net.sf.briar.transport.ConnectionWriterTest'/>
|
||||
<test name='net.sf.briar.transport.FrameReadWriteTest'/>
|
||||
<test name='net.sf.briar.transport.batch.BatchConnectionReadWriteTest'/>
|
||||
<test name='net.sf.briar.util.ByteUtilsTest'/>
|
||||
<test name='net.sf.briar.util.FileUtilsTest'/>
|
||||
<test name='net.sf.briar.util.StringUtilsTest'/>
|
||||
|
||||
@@ -52,10 +52,10 @@ import net.sf.briar.crypto.CryptoModule;
|
||||
import net.sf.briar.db.DatabaseModule;
|
||||
import net.sf.briar.lifecycle.LifecycleModule;
|
||||
import net.sf.briar.protocol.ProtocolModule;
|
||||
import net.sf.briar.protocol.batch.ProtocolBatchModule;
|
||||
import net.sf.briar.protocol.stream.ProtocolStreamModule;
|
||||
import net.sf.briar.serial.SerialModule;
|
||||
import net.sf.briar.transport.TransportModule;
|
||||
import net.sf.briar.transport.batch.TransportBatchModule;
|
||||
import net.sf.briar.transport.stream.TransportStreamModule;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -97,8 +97,8 @@ public class ProtocolIntegrationTest extends TestCase {
|
||||
Injector i = Guice.createInjector(testModule, new CryptoModule(),
|
||||
new DatabaseModule(), new LifecycleModule(),
|
||||
new ProtocolModule(), new SerialModule(),
|
||||
new TestDatabaseModule(), new TransportBatchModule(),
|
||||
new TransportModule(), new TransportStreamModule());
|
||||
new TestDatabaseModule(), new ProtocolBatchModule(),
|
||||
new TransportModule(), new ProtocolStreamModule());
|
||||
connectionReaderFactory = i.getInstance(ConnectionReaderFactory.class);
|
||||
connectionWriterFactory = i.getInstance(ConnectionWriterFactory.class);
|
||||
protocolReaderFactory = i.getInstance(ProtocolReaderFactory.class);
|
||||
|
||||
@@ -46,10 +46,10 @@ import net.sf.briar.api.transport.ConnectionWindowFactory;
|
||||
import net.sf.briar.crypto.CryptoModule;
|
||||
import net.sf.briar.lifecycle.LifecycleModule;
|
||||
import net.sf.briar.protocol.ProtocolModule;
|
||||
import net.sf.briar.protocol.batch.ProtocolBatchModule;
|
||||
import net.sf.briar.protocol.stream.ProtocolStreamModule;
|
||||
import net.sf.briar.serial.SerialModule;
|
||||
import net.sf.briar.transport.TransportModule;
|
||||
import net.sf.briar.transport.batch.TransportBatchModule;
|
||||
import net.sf.briar.transport.stream.TransportStreamModule;
|
||||
|
||||
import org.apache.commons.io.FileSystemUtils;
|
||||
import org.junit.After;
|
||||
@@ -107,8 +107,8 @@ public class H2DatabaseTest extends TestCase {
|
||||
Injector i = Guice.createInjector(testModule, new CryptoModule(),
|
||||
new DatabaseModule(), new LifecycleModule(),
|
||||
new ProtocolModule(), new SerialModule(),
|
||||
new TransportBatchModule(), new TransportModule(),
|
||||
new TransportStreamModule(), new TestDatabaseModule(testDir));
|
||||
new ProtocolBatchModule(), new TransportModule(),
|
||||
new ProtocolStreamModule(), new TestDatabaseModule(testDir));
|
||||
connectionContextFactory =
|
||||
i.getInstance(ConnectionContextFactory.class);
|
||||
connectionWindowFactory = i.getInstance(ConnectionWindowFactory.class);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.sf.briar.transport.batch;
|
||||
package net.sf.briar.protocol.batch;
|
||||
|
||||
import static net.sf.briar.api.transport.TransportConstants.TAG_LENGTH;
|
||||
|
||||
@@ -43,9 +43,12 @@ import net.sf.briar.db.DatabaseModule;
|
||||
import net.sf.briar.lifecycle.LifecycleModule;
|
||||
import net.sf.briar.plugins.ImmediateExecutor;
|
||||
import net.sf.briar.protocol.ProtocolModule;
|
||||
import net.sf.briar.protocol.batch.IncomingBatchConnection;
|
||||
import net.sf.briar.protocol.batch.OutgoingBatchConnection;
|
||||
import net.sf.briar.protocol.batch.ProtocolBatchModule;
|
||||
import net.sf.briar.protocol.stream.ProtocolStreamModule;
|
||||
import net.sf.briar.serial.SerialModule;
|
||||
import net.sf.briar.transport.TransportModule;
|
||||
import net.sf.briar.transport.stream.TransportStreamModule;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
@@ -97,8 +100,8 @@ public class BatchConnectionReadWriteTest extends TestCase {
|
||||
return Guice.createInjector(testModule, new CryptoModule(),
|
||||
new DatabaseModule(), new LifecycleModule(),
|
||||
new ProtocolModule(), new SerialModule(),
|
||||
new TestDatabaseModule(dir), new TransportBatchModule(),
|
||||
new TransportModule(), new TransportStreamModule());
|
||||
new TestDatabaseModule(dir), new ProtocolBatchModule(),
|
||||
new TransportModule(), new ProtocolStreamModule());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -16,9 +16,9 @@ import net.sf.briar.crypto.CryptoModule;
|
||||
import net.sf.briar.db.DatabaseModule;
|
||||
import net.sf.briar.lifecycle.LifecycleModule;
|
||||
import net.sf.briar.protocol.ProtocolModule;
|
||||
import net.sf.briar.protocol.batch.ProtocolBatchModule;
|
||||
import net.sf.briar.protocol.stream.ProtocolStreamModule;
|
||||
import net.sf.briar.serial.SerialModule;
|
||||
import net.sf.briar.transport.batch.TransportBatchModule;
|
||||
import net.sf.briar.transport.stream.TransportStreamModule;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -44,8 +44,8 @@ public class ConnectionWriterTest extends TestCase {
|
||||
Injector i = Guice.createInjector(testModule, new CryptoModule(),
|
||||
new DatabaseModule(), new LifecycleModule(),
|
||||
new ProtocolModule(), new SerialModule(),
|
||||
new TestDatabaseModule(), new TransportBatchModule(),
|
||||
new TransportModule(), new TransportStreamModule());
|
||||
new TestDatabaseModule(), new ProtocolBatchModule(),
|
||||
new TransportModule(), new ProtocolStreamModule());
|
||||
connectionWriterFactory = i.getInstance(ConnectionWriterFactory.class);
|
||||
secret = new byte[32];
|
||||
new Random().nextBytes(secret);
|
||||
|
||||
Reference in New Issue
Block a user