use of com.sun.appserv.management.client.AppserverConnectionSource in project Payara by payara.
the class TestMain method _getConnectionSource.
private AppserverConnectionSource _getConnectionSource(final PropertyGetter getter, final String host, final int port) throws IOException {
final String user = getter.getString(USER_KEY);
final String password = getter.getString(PASSWORD_KEY);
final File trustStore = getter.getFile(TRUSTSTORE_KEY);
final String trustStorePassword = getter.getString(TRUSTSTORE_PASSWORD_KEY);
final boolean useTLS = getter.getboolean(USE_TLS_KEY);
final TLSParams tlsParams = useTLS ? createTLSParams(trustStore, trustStorePassword) : null;
AppserverConnectionSource conn = null;
try {
conn = connect(host, port, user, password, tlsParams);
if (mHandshakeCompletedListener != null) {
assert (mHandshakeCompletedListener.getLastEvent() != null);
println("HandshakeCompletedEvent: " + toString(mHandshakeCompletedListener.getLastEvent()));
}
} catch (IOException e) {
if (useTLS) {
// try without TLS
println("Attempting connection without TLS...");
conn = connect(host, port, user, password, null);
}
}
if (conn != null) {
conn.getJMXConnector(false).addConnectionNotificationListener(this, null, conn);
}
return (conn);
}
use of com.sun.appserv.management.client.AppserverConnectionSource in project Payara by payara.
the class TestMain method connect.
/**
* @param host hostname or IP address of Domain Admin Server
* @param port RMI administrative port
* @param user admin user
* @param password admin user password
* @param tlsParams TLS parameters, may be null
* @return AppserverConnectionSource
*/
public static AppserverConnectionSource connect(final String host, final int port, final String user, final String password, final TLSParams tlsParams) throws IOException {
final String info = "host=" + host + ", port=" + port + ", user=" + user + ", password=" + password + ", tls=" + (tlsParams != null);
println("Connecting: " + info + "...");
final AppserverConnectionSource conn = new AppserverConnectionSource(AppserverConnectionSource.PROTOCOL_JMXMP, host, port, user, password, tlsParams, null);
conn.getJMXConnector(false);
return (conn);
}
Aggregations