mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 12:19:54 +01:00
Whitespace-only code formatting changes.
This commit is contained in:
@@ -75,7 +75,7 @@ public class ConnectionRegistryImplTest extends BriarTestCase {
|
||||
try {
|
||||
c.unregisterConnection(contactId, transportId);
|
||||
fail();
|
||||
} catch(IllegalArgumentException expected) {}
|
||||
} catch (IllegalArgumentException expected) {}
|
||||
// Register both contacts with one transport, one contact with both -
|
||||
// this should broadcast two ContactConnectedEvents
|
||||
c.registerConnection(contactId, transportId);
|
||||
|
||||
@@ -20,7 +20,7 @@ public abstract class DuplexClientTest extends DuplexTest {
|
||||
assert plugin != null;
|
||||
// Start the plugin
|
||||
System.out.println("Starting plugin");
|
||||
if(!plugin.start()) {
|
||||
if (!plugin.start()) {
|
||||
System.out.println("Plugin failed to start");
|
||||
return;
|
||||
}
|
||||
@@ -28,14 +28,14 @@ public abstract class DuplexClientTest extends DuplexTest {
|
||||
// Try to connect to the server
|
||||
System.out.println("Creating connection");
|
||||
DuplexTransportConnection d = plugin.createConnection(contactId);
|
||||
if(d == null) {
|
||||
if (d == null) {
|
||||
System.out.println("Connection failed");
|
||||
return;
|
||||
} else {
|
||||
System.out.println("Connection created");
|
||||
receiveChallengeSendResponse(d);
|
||||
}
|
||||
if(!plugin.supportsInvitations()) {
|
||||
if (!plugin.supportsInvitations()) {
|
||||
System.out.println("Skipping invitation test");
|
||||
return;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public abstract class DuplexClientTest extends DuplexTest {
|
||||
System.out.println("Creating invitation connection");
|
||||
PseudoRandom r = getPseudoRandom(123);
|
||||
d = plugin.createInvitationConnection(r, CONNECTION_TIMEOUT);
|
||||
if(d == null) {
|
||||
if (d == null) {
|
||||
System.out.println("Connection failed");
|
||||
return;
|
||||
} else {
|
||||
|
||||
@@ -21,18 +21,18 @@ public abstract class DuplexServerTest extends DuplexTest {
|
||||
assert plugin != null;
|
||||
// Start the plugin
|
||||
System.out.println("Starting plugin");
|
||||
if(!plugin.start()) {
|
||||
if (!plugin.start()) {
|
||||
System.out.println("Plugin failed to start");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// Wait for a connection
|
||||
System.out.println("Waiting for connection");
|
||||
if(!callback.latch.await(120, SECONDS)) {
|
||||
if (!callback.latch.await(120, SECONDS)) {
|
||||
System.out.println("No connection received");
|
||||
return;
|
||||
}
|
||||
if(!plugin.supportsInvitations()) {
|
||||
if (!plugin.supportsInvitations()) {
|
||||
System.out.println("Skipping invitation test");
|
||||
return;
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public abstract class DuplexServerTest extends DuplexTest {
|
||||
System.out.println("Creating invitation connection");
|
||||
DuplexTransportConnection d = plugin.createInvitationConnection(
|
||||
getPseudoRandom(123), CONNECTION_TIMEOUT);
|
||||
if(d == null) {
|
||||
if (d == null) {
|
||||
System.out.println("Connection failed");
|
||||
return;
|
||||
} else {
|
||||
|
||||
@@ -31,10 +31,10 @@ abstract class DuplexTest {
|
||||
out.flush();
|
||||
System.out.println("Sent challenge: " + CHALLENGE);
|
||||
Scanner in = new Scanner(r.getInputStream());
|
||||
if(in.hasNextLine()) {
|
||||
if (in.hasNextLine()) {
|
||||
String response = in.nextLine();
|
||||
System.out.println("Received response: " + response);
|
||||
if(RESPONSE.equals(response)) {
|
||||
if (RESPONSE.equals(response)) {
|
||||
System.out.println("Correct response");
|
||||
} else {
|
||||
System.out.println("Incorrect response");
|
||||
@@ -44,12 +44,12 @@ abstract class DuplexTest {
|
||||
}
|
||||
r.dispose(false, true);
|
||||
w.dispose(false);
|
||||
} catch(IOException e) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
r.dispose(true, true);
|
||||
w.dispose(true);
|
||||
} catch(IOException e1) {
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -61,10 +61,10 @@ abstract class DuplexTest {
|
||||
TransportConnectionWriter w = d.getWriter();
|
||||
try {
|
||||
Scanner in = new Scanner(r.getInputStream());
|
||||
if(in.hasNextLine()) {
|
||||
if (in.hasNextLine()) {
|
||||
String challenge = in.nextLine();
|
||||
System.out.println("Received challenge: " + challenge);
|
||||
if(CHALLENGE.equals(challenge)) {
|
||||
if (CHALLENGE.equals(challenge)) {
|
||||
|
||||
PrintStream out = new PrintStream(w.getOutputStream());
|
||||
out.println(RESPONSE);
|
||||
@@ -78,12 +78,12 @@ abstract class DuplexTest {
|
||||
}
|
||||
r.dispose(false, true);
|
||||
w.dispose(false);
|
||||
} catch(IOException e) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
r.dispose(true, true);
|
||||
w.dispose(true);
|
||||
} catch(IOException e1) {
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class BluetoothClientTest extends DuplexClientTest {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
if(args.length != 1) {
|
||||
if (args.length != 1) {
|
||||
System.err.println("Please specify the server's Bluetooth address");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class PollingRemovableDriveMonitorTest extends BriarTestCase {
|
||||
private AtomicBoolean firstCall = new AtomicBoolean(true);
|
||||
|
||||
public Collection<File> findRemovableDrives() throws IOException {
|
||||
if(firstCall.getAndSet(false)) return Collections.emptyList();
|
||||
if (firstCall.getAndSet(false)) return Collections.emptyList();
|
||||
else return Arrays.asList(file1, file2);
|
||||
}
|
||||
};
|
||||
@@ -68,7 +68,7 @@ public class PollingRemovableDriveMonitorTest extends BriarTestCase {
|
||||
private AtomicBoolean firstCall = new AtomicBoolean(true);
|
||||
|
||||
public Collection<File> findRemovableDrives() throws IOException {
|
||||
if(firstCall.getAndSet(false)) return Collections.emptyList();
|
||||
if (firstCall.getAndSet(false)) return Collections.emptyList();
|
||||
else throw new IOException();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ public class UnixRemovableDriveMonitorTest extends BriarTestCase {
|
||||
|
||||
@Test
|
||||
public void testNonexistentDir() throws Exception {
|
||||
if(!(OsUtils.isLinux() || OsUtils.isMacLeopardOrNewer())) {
|
||||
if (!(OsUtils.isLinux() || OsUtils.isMacLeopardOrNewer())) {
|
||||
System.err.println("WARNING: Skipping test, can't run on this OS");
|
||||
return;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class UnixRemovableDriveMonitorTest extends BriarTestCase {
|
||||
|
||||
@Test
|
||||
public void testOneCallbackPerFile() throws Exception {
|
||||
if(!(OsUtils.isLinux() || OsUtils.isMacLeopardOrNewer())) {
|
||||
if (!(OsUtils.isLinux() || OsUtils.isMacLeopardOrNewer())) {
|
||||
System.err.println("WARNING: Skipping test, can't run on this OS");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class LanTcpClientTest extends DuplexClientTest {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
if(args.length != 2) {
|
||||
if (args.length != 2) {
|
||||
System.err.println("Please specify the server's address and port");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
@@ -69,13 +69,13 @@ public class LanTcpPluginTest extends BriarTestCase {
|
||||
|
||||
private byte[] makeAddress(int... parts) {
|
||||
byte[] b = new byte[parts.length];
|
||||
for(int i = 0; i < parts.length; i++) b[i] = (byte) parts[i];
|
||||
for (int i = 0; i < parts.length; i++) b[i] = (byte) parts[i];
|
||||
return b;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIncomingConnection() throws Exception {
|
||||
if(!systemHasLocalIpv4Address()) {
|
||||
if (!systemHasLocalIpv4Address()) {
|
||||
System.err.println("WARNING: Skipping test, no local IPv4 address");
|
||||
return;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public class LanTcpPluginTest extends BriarTestCase {
|
||||
|
||||
@Test
|
||||
public void testOutgoingConnection() throws Exception {
|
||||
if(!systemHasLocalIpv4Address()) {
|
||||
if (!systemHasLocalIpv4Address()) {
|
||||
System.err.println("WARNING: Skipping test, no local IPv4 address");
|
||||
return;
|
||||
}
|
||||
@@ -131,7 +131,7 @@ public class LanTcpPluginTest extends BriarTestCase {
|
||||
try {
|
||||
ss.accept();
|
||||
latch.countDown();
|
||||
} catch(IOException e) {
|
||||
} catch (IOException e) {
|
||||
error.set(true);
|
||||
}
|
||||
}
|
||||
@@ -155,10 +155,10 @@ public class LanTcpPluginTest extends BriarTestCase {
|
||||
}
|
||||
|
||||
private boolean systemHasLocalIpv4Address() throws Exception {
|
||||
for(NetworkInterface i : Collections.list(
|
||||
for (NetworkInterface i : Collections.list(
|
||||
NetworkInterface.getNetworkInterfaces())) {
|
||||
for(InetAddress a : Collections.list(i.getInetAddresses())) {
|
||||
if(a instanceof Inet4Address)
|
||||
for (InetAddress a : Collections.list(i.getInetAddresses())) {
|
||||
if (a instanceof Inet4Address)
|
||||
return a.isLinkLocalAddress() || a.isSiteLocalAddress();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user