}
public static String pair(final String uniqueId, final String host) {
String message = "";
NvHTTP httpConn;
try {
httpConn = new NvHTTP(InetAddress.getByName(host),
uniqueId, PlatformBinding.getDeviceName(), PlatformBinding.getCryptoProvider());
try {
if (httpConn.getPairState() == PairingManager.PairState.PAIRED) {
message = "Already paired";
}
else {
final String pinStr = PairingManager.generatePinString();
// Spin the dialog off in a thread because it blocks
new Thread(new Runnable() {
public void run() {
JOptionPane.showMessageDialog(null, "Please enter the following PIN on the target PC: "+pinStr,
"Limelight", JOptionPane.INFORMATION_MESSAGE);
}
}).start();
PairingManager.PairState pairState = httpConn.pair(pinStr);
if (pairState == PairingManager.PairState.PIN_WRONG) {
message = "Incorrect PIN";
}
else if (pairState == PairingManager.PairState.FAILED) {
message = "Pairing failed";