code: public void connectToDeviceWithLink(Device device, Link link)
              throws ShanksException {
          this.connectToLink(link);
          try {
              device.connectToLink(link);
          } catch (ShanksException e) {
              this.disconnectFromLink(link);
              throw e;
          }
      }
docs: Connect the device to other device with a link
  
  @param device
  @param link
  @throws TooManyConnectionException