Commit 42462e1c authored by Roberta De Viti's avatar Roberta De Viti

print exception

parent a551f513
package org.mpisws.testapp.simulator;
public class Alarm {
}
package org.mpisws.testapp.simulator;
public class NullWakelock {
}
...@@ -29,7 +29,7 @@ import java.util.UUID; ...@@ -29,7 +29,7 @@ import java.util.UUID;
*/ */
public class SimulationClientBT { public class SimulationClientBT {
Context context; Context context;
protected static final int NUM_SIMULATED_DEVICES = 100; protected static final int NUM_SIMULATED_DEVICES = 10;
protected static final int NUM_SIMULATED_EPOCHS = 10; protected static final int NUM_SIMULATED_EPOCHS = 10;
private static final String TAG = SimulationClientBT.class.getSimpleName(); private static final String TAG = SimulationClientBT.class.getSimpleName();
...@@ -115,10 +115,13 @@ public class SimulationClientBT { ...@@ -115,10 +115,13 @@ public class SimulationClientBT {
} }
private void sendDHKeysOverSocket(BluetoothSocket sock) { private void sendDHKeysOverSocket(BluetoothSocket sock) {
try { try {
if (sock == null) return; if (sock == null) return;
OutputStream os = sock.getOutputStream(); OutputStream os = sock.getOutputStream();
ObjectOutputStream out = new ObjectOutputStream(os); ObjectOutputStream out = new ObjectOutputStream(os);
out.writeObject(mSharedSecrets); out.writeObject(mSharedSecrets);
out.writeObject(otherDHNonces); out.writeObject(otherDHNonces);
out.writeObject(otherDHPubKeys); out.writeObject(otherDHPubKeys);
...@@ -130,12 +133,15 @@ public class SimulationClientBT { ...@@ -130,12 +133,15 @@ public class SimulationClientBT {
Log.d(TAG, "Got response: " + line); Log.d(TAG, "Got response: " + line);
in.close(); in.close();
os.close();
out.close(); out.close();
os.close();
sock.close(); sock.close();
} catch (IOException e) { } catch (IOException e) {
System.out.println("SimulationClient: General I/O exception: " + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
// run the simulator core // run the simulator core
Log.d(TAG, "Running simulator core!"); Log.d(TAG, "Running simulator core!");
new Thread(core).start(); new Thread(core).start();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment