DistoXProtocol { public static byte[] createAcknowledgementPacket(byte[] packet) { byte[] acknowledgePacket = new byte[1]; acknowledgePacket[0] = (byte) ((packet[ADMIN] & SEQUENCE_BIT_MASK) | ACKNOWLEDGEMENT_PACKET_BASE); return acknowledgePacket; } protected  DistoXProtocol(
            SexyTopoActivity activity, BluetoothDevice bluetoothDevice, SurveyManager dataManager); static byte[] createAcknowledgementPacket(byte[] packet); abstract void go(DataInputStream inStream, DataOutputStream outStream); static boolean arePacketsTheSame(byte[] packet0, byte[] packet1); @SuppressLint("all") static String describePacket(byte[] packet); static String asBinaryString(int theByte); static String describeAcknowledgementPacket(byte[] acknowledgementPacket); static final int INTER_PACKET_DELAY; static final int WAIT_BETWEEN_CONNECTION_ATTEMPTS_MS; static final int ADMIN; static final int SEQUENCE_BIT_MASK; static final int ACKNOWLEDGEMENT_PACKET_BASE; }
@Test public void testAcknowledgePacketMatchesByteEndingIn1() { byte control = 0b00000001; byte[] packet = new byte[]{control, i, i, i, i, i, i, i}; byte actual = DistoXProtocol.createAcknowledgementPacket(packet)[0]; Assert.assertEquals((byte)0b01010101, actual); }
@Test public void testAcknowledgePacketMatchesByteEndingIn0() { byte control = 0b00000010; byte[] packet = new byte[]{control, i, i, i, i, i, i, i}; byte actual = DistoXProtocol.createAcknowledgementPacket(packet)[0]; Assert.assertEquals((byte)0b01010101, actual); }