public void l2ServerClose(long handle, ServiceRecordImpl serviceRecord) throws IOException {
   assertClosed();
   EmulatorL2CAPService s = ((EmulatorL2CAPService) localDevice.getConnection(handle));
   try {
     s.close(serviceRecord);
   } finally {
     localDevice.removeConnection(s);
   }
 }
 public void l2CloseClientConnection(long handle) throws IOException {
   assertClosed();
   EmulatorL2CAPClient c = ((EmulatorL2CAPClient) localDevice.getConnection(handle));
   try {
     c.close();
   } finally {
     localDevice.removeConnection(c);
   }
 }
 public void rfServerClose(long handle, ServiceRecordImpl serviceRecord) throws IOException {
   assertClosed();
   if (localDevice == null) {
     return;
   }
   EmulatorRFCOMMService s = ((EmulatorRFCOMMService) localDevice.getConnection(handle));
   try {
     s.close(serviceRecord);
   } finally {
     if (localDevice != null) {
       localDevice.removeConnection(s);
     }
   }
 }
 public void connectionRfCloseClientConnection(long handle) throws IOException {
   assertClosed();
   if (localDevice == null) {
     return;
   }
   EmulatorRFCOMMClient c = ((EmulatorRFCOMMClient) localDevice.getConnection(handle));
   try {
     c.close();
   } finally {
     if (localDevice != null) {
       localDevice.removeConnection(c);
     }
   }
 }
 /*
  * (non-Javadoc)
  *
  * @see com.intel.bluetooth.BluetoothStack#l2Encrypt(long,long,boolean)
  */
 public boolean l2Encrypt(long address, long handle, boolean on) throws IOException {
   assertClosed();
   return ((EmulatorLinkedConnection) localDevice.getConnection(handle)).encrypt(address, on);
 }
 public int l2GetSecurityOpt(long handle, int expected) throws IOException {
   assertClosed();
   return ((EmulatorLinkedConnection) localDevice.getConnection(handle)).getSecurityOpt(expected);
 }