aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/xmpp/s2s/Connection.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-07-06 19:04:41 +0300
committerGravatar Vitaly Takmazov2016-07-06 19:04:41 +0300
commit02fd70cf59c30e3a9702eaf60d9e51f460efd8ca (patch)
treec76d3ec3465437c66c6a63d1afcc921d540edb23 /src/main/java/com/juick/xmpp/s2s/Connection.java
parentd48e3b71c27d6782a63dda84aced58780b54f309 (diff)
static components are evil
Diffstat (limited to 'src/main/java/com/juick/xmpp/s2s/Connection.java')
-rw-r--r--src/main/java/com/juick/xmpp/s2s/Connection.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/com/juick/xmpp/s2s/Connection.java b/src/main/java/com/juick/xmpp/s2s/Connection.java
index c1bbf22e..eae6efaa 100644
--- a/src/main/java/com/juick/xmpp/s2s/Connection.java
+++ b/src/main/java/com/juick/xmpp/s2s/Connection.java
@@ -30,6 +30,7 @@ public class Connection {
public long tsLocalData = 0;
public long bytesLocal = 0;
public long packetsLocal = 0;
+ XMPPComponent xmpp;
Socket socket;
public static final String NS_DB = "jabber:server:dialback";
public static final String NS_TLS = "urn:ietf:params:xml:ns:xmpp-tls";
@@ -52,17 +53,18 @@ public class Connection {
};
- public Connection() throws XmlPullParserException, KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException, UnrecoverableKeyException, KeyManagementException {
+ public Connection(XMPPComponent xmpp) throws XmlPullParserException, KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException, UnrecoverableKeyException, KeyManagementException {
+ this.xmpp = xmpp;
tsCreated = System.currentTimeMillis();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
KeyStore ks = KeyStore.getInstance("JKS");
- try (InputStream ksIs = new FileInputStream(XMPPComponent.keystore)) {
- ks.load(ksIs, XMPPComponent.keystorePassword.toCharArray());
+ try (InputStream ksIs = new FileInputStream(xmpp.keystore)) {
+ ks.load(ksIs, xmpp.keystorePassword.toCharArray());
}
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory
.getDefaultAlgorithm());
- kmf.init(ks, XMPPComponent.keystorePassword.toCharArray());
+ kmf.init(ks, xmpp.keystorePassword.toCharArray());
sc = SSLContext.getInstance("TLSv1.2");
sc.init(kmf.getKeyManagers(), trustAllCerts, new SecureRandom());