LlcpTargetListener implements TargetListener { protected Object[] extractLlcParameters(byte[] incomingGeneralBytes) { byte[] incomingLlcParameters = {}; for (int x = 0; x <= incomingGeneralBytes.length - llcHeader.length; x++) { boolean match = true; for (int h = 0; h < llcHeader.length; h++) { if (incomingGeneralBytes[x + h] != llcHeader[h]) { match = false; break; } } if (match && incomingGeneralBytes.length > x + llcHeader.length) { incomingLlcParameters = new byte[incomingGeneralBytes.length - x - llcHeader.length]; System.arraycopy(incomingGeneralBytes, x + llcHeader.length, incomingLlcParameters, 0, incomingLlcParameters.length); } } PduDecoder pduDecoder = new PduDecoder(); Object[] parameter = pduDecoder.decodeParameter(incomingLlcParameters, 0); return parameter; } LlcpTargetListener(byte[] llcParameters); @Override void onTarget(Target target, NfcContext nfcContext);  }
@Test public void testExtractLlcParameters() throws Exception { byte[] generalBytes = { 0x1E, (byte)0xD4, 0x00, 0x01, (byte)0xFE, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x46, 0x66, 0x6D, 0x01, 0x01, 0x10, 0x03, 0x02, 0x00, 0x01, 0x04, 0x01, (byte)0x96 }; LlcpTargetListener llcpTargetListener = new LlcpTargetListener(null); Object[] llcParameters = llcpTargetListener.extractLlcParameters(generalBytes); assertEquals(3, llcParameters.length); }