This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override public void onMessage(Message msg) { | |
if (msg instanceof BytesMessage) { | |
BytesMessage bMsg = (BytesMessage) msg; | |
StringBuilder buffer = new StringBuilder(); | |
try { | |
for (int i = 0; i < (int)bMsg.getBodyLength(); i++) { | |
buffer.append((char) bMsg.readByte()); | |
} | |
} catch (JMSException e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SERVER1 = 'X.X.X.X' SERVER2 = 'X.X.X.X' PORT = XXXXX client = PublishClient(SERVER1, ACTIVEMQ_PORT) | |
ip_dest = '' activemq_ip = SERVER1 | |
try: response = client.connect(USER, PASSWORD) activemq_ip = SERVER1 except Exception as e: client = PublishClient(SERVER2, PORT) | |
try: response = client.connect(USER, PASSWORD) activemq_ip = SERVER2 except Exception as e: if (mq_params['count'] == 0): | |
print "Could not connect to activemq." time.sleep(3) mq_params['count'] += 1 self.send(mq_params) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.io.InputStream; | |
import java.security.KeyManagementException; | |
import java.security.KeyStore; | |
import java.security.KeyStoreException; | |
import java.security.NoSuchAlgorithmException; | |
import java.security.UnrecoverableKeyException; | |
import org.apache.http.conn.ssl.SSLSocketFactory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AsyncHttpClient client = new AsyncHttpClient(); | |
if (MainActivity.DEVELOPER_MODE) { | |
try { | |
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); | |
trustStore.load(null, null); | |
final SSLSocketFactory sf = CustomSSLSocketFactory.getSSLSocketFactory(context); | |
sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); | |
client.setSSLSocketFactory(sf); | |
} catch (final Exception e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.security.SecureRandom; | |
import java.security.cert.CertificateException; | |
import java.security.cert.CertificateFactory; | |
import java.security.cert.X509Certificate; | |
import javax.net.ssl.HostnameVerifier; |