public static USBConnectionForModem getConnection() throws PortInUseException,
		UnsupportedCommOperationException, IOException {
		@SuppressWarnings("unchecked")
		Enumeration<CommPortIdentifier> ports = CommPortIdentifier.getPortIdentifiers();

		logger.debug("Starting to probe ports for modem.");

		while (ports.hasMoreElements()) {
			CommPortIdentifier portId = ports.nextElement();

			logger.info("Probing port: " + portId.getName());
			if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
				logger.debug("Opening serial port " + portId.getName() + " for probing.");
				try{
					USBConnectionForModem u = new USBConnectionForModem(portId);
					if (u.isActive()) {
						logger.info("Probe successful for port: " + portId.getName());
						return u;
					}
					u.disconnect();
				} catch(Exception e){
					//Ignore Exceptions
				}
			}
		}

		// did not probe successfully on any port :(
		return null;
	}