Encryption

The connector supports Java native SSL and Firebase native packet encryption. The encryption type is is passed as an enumeration to the constructor. The enumeration has the following types:

NONE

No encryption. This is the default value.

NAIVE_SSL

SSL but where any server certificate is accepted. This is un-secure, but useful for development.

SSL

Full SSL, this is configured with Java system properties.

FIREBASE_NATIVE

Native Firebase packet encryption.

The naive SSL should only be used for testing and development.

Should you need to configure SSL outside the system properties, you can extend the SocketConnector and override its getSSLSocketFactory(Encryption) method.

If Firebase native packet encryption is used, the connector will try to wait for the encryption key exchange to finish before returning from the connect() method. This interval is defaulted to 5 seconds (5000 millis) but can be configured before connect is called, like so:

[...]

/*
 * Example parameters
 */
int port = 4123;
String host = "localhost";
Encryption enc = Encryption.FIREBAE_NATIVE;
long wait = 10000; // 10 secs

/*
 * Create connector, set key exchange wait 
 * period and connect
 */
Connector connector = new SocketConnector(host, port, enc);
((SocketConnector)connector).setKeyExchangeWait(wait);
connector.connect();
                
[...]