/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4865397
* @summary Tests remote JMX connections
* @author Eamonn McManus
* @run clean ConnectionTest
* @run build ConnectionTest
* @run main ConnectionTest
*/
public class ConnectionTest {
// System.setProperty("java.util.logging.config.file",
// "../../../../logging.properties");
// java.util.logging.LogManager.getLogManager().readConfiguration();
boolean ok = true;
try {
} catch (Exception e) {
e.printStackTrace();
ok = false;
}
}
if (ok)
else {
}
}
try {
server =
null);
} catch (MalformedURLException e) {
" not supported, ignoring");
return true;
}
return false;
}
if (!ok)
return false;
// 4901826: connection ids need some time to be updated using jmxmp
// we don't get the notif immediately either
// this was originally timeout 1ms, which was not enough
if (!ok)
return false;
if (!ok)
return false;
return false;
}
if (!ok)
return false;
notif);
if (!ok)
return false;
try {
return false;
} catch (IOException e) {
}
try {
"not be");
return false;
} catch (IOException e) {
}
return true;
}
private static boolean
if (!(notif instanceof JMXConnectionNotification)) {
"JMXConnectionNotification: " +
return false;
}
return false;
}
return false;
}
return true;
}
/**
* Checks the connection id for validity.
* The {@link
* javax.management.remote package description} describes the
* conventions for connection IDs.
* @param proto Connection protocol
* @param clientConnId The connection ID
* @return Returns {@code true} if the connection id conforms to the specification; {@code false} otherwise.
* @throws Exception
*/
throws Exception {
String s;
"\"");
return false;
}
if (hostAddrInd > -1) {
return false;
}
}
}
if (!s.equals(" ")) {
return false;
}
"\", expected name, found \";\"");
return false;
}
throw new Exception("Can't happen");
"\", expected name, found \";\"");
return false;
}
if (tok2.hasMoreTokens()) {
return false;
}
bogusPrincipals.size());
return false;
}
p.getName() + "\"");
return false;
}
}
if (!s.equals(" ")) {
return false;
}
return true;
}
throws InterruptedException {
synchronized (log) {
long remainingTime = timeout;
}
throw new InterruptedException("Timed out waiting for " +
"notification!");
}
}
}
}
}
synchronized (log) {
}
}
}
new Subject(true, bogusPrincipals,
return subject;
}
}
static {
}
}