// JAVADOC COMMENT ELIDED public boolean authorize(Connection conn) throws IOException { BluetoothConnection btconn = BluetoothConnection.getConnection(conn); if (!equals(btconn.getRemoteDevice())) { throw new IllegalArgumentException( "The specified connection " + "is not a connection to this RemoteDevice."); } if (!btconn.isServerSide()) { throw new IllegalArgumentException( "The local device is client " + "rather than the server for the specified connection."); } return authenticate() && (isTrustedDevice() || btconn.isAuthorized() || btconn.authorize()); }
// JAVADOC COMMENT ELIDED public boolean isAuthorized(Connection conn) throws IOException { BluetoothConnection btconn = BluetoothConnection.getConnection(conn); RemoteDevice device; try { device = btconn.getRemoteDevice(); } catch (IllegalArgumentException e) { return false; } if (!equals(device)) { throw new IllegalArgumentException( "The specified connection " + "is not a connection to this RemoteDevice."); } return btconn.isServerSide() && btconn.isAuthorized(); }