@Test
public void testWellKnownServiceConnectWithSendAndDisconnect() throws Exception {
DummyServiceAccessPoint serviceAccessPoint = new DummyServiceAccessPoint("Hello", COM_ANDROID_NPP);
connectionManager.registerWellKnownServiceAccessPoint(COM_ANDROID_NPP, serviceAccessPoint);
AbstractProtocolDataUnit processPdu = new Symmetry().processPdu(connectionManager);
assertTrue(processPdu.toString(), processPdu instanceof Connect);
assertEquals(0, connectionManager.getOpenConnectionsSize());
Connect connect = (Connect)processPdu;
assertEquals(1, connect.getDestinationServiceAccessPoint());
assertEquals(32, connect.getSourceServiceAccessPoint());
processPdu = new ConnectComplete(connect.getSourceServiceAccessPoint(),
connect.getDestinationServiceAccessPoint()).processPdu(connectionManager);
assertEquals(1, connectionManager.getOpenConnectionsSize());
assertTrue(processPdu.toString(), processPdu instanceof Information);
Information information = (Information)processPdu;
assertEquals("Hello", new String(information.getServiceDataUnit()));
processPdu = new ReceiveReady(information.getSourceServiceAccessPoint(),
information.getDestinationServiceAccessPoint(), 1).processPdu(connectionManager);
assertTrue(processPdu.toString(), processPdu instanceof Disconnect);
Disconnect disconnect = (Disconnect)processPdu;
processPdu = new DisconnectedMode(disconnect.getSourceServiceAccessPoint(),
disconnect.getDestinationServiceAccessPoint(), 0).processPdu(connectionManager);