boolean useRemoteListener = !cbDisableRemoteListener.getSelection();
try {
GuiController.getInstance().getProfileManager().setRemoteConnected(true);
GuiController.getInstance().getProfileManager().stopScheduler();
RemoteManager remoteManager = new RemoteManager(hostname, port, password);
if (!remoteManager.isConnectedToRemoteInstance()) {
remoteManager.setUseRemoteListener(useRemoteListener);
GuiController.getInstance().getProfileManager().setRemoteConnection(remoteManager);
GuiController.getInstance().getSynchronizer().setRemoteConnection(remoteManager);
}
else {
throw new Exception("The FullSync instance you tried to connect to is already connected to another FullSync instance");