Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
impl
model
.gitignore
.travis.yml
Dockerfile
README.adoc
apns-mock-compose.yml
pom.xml

README.adoc

Running in Docker

For APNs currently, just run this:

docker run -p 16002-16003:16002-16003 aerogear/push-network-proxies

Proxy

Proxy acts as a fake notification provider (APNS / FCM). From consumer point of view, the notifications which the consumer sends to networks hit this proxy and proxy answers the consumer back as if the response came from the real providers.

This project is used for testing purposes.

Installation is done by mvn clean install. Resulting binary is in impl/target/proxy.

Proxy binary offers two commands. Every command covers the proxy for one notification platform. There are two platfroms implemented - APNS and FCM

Note
If you want to start proxy for both networks, you have to have two running binaries of proxy.
$ ./proxy help
usage: proxy <command> [<args>]

The most commonly used proxy commands are:
    apnsProxy   starts APNS proxy
    fcmProxy    starts FCM proxy
    help        Display help information

APNS proxy

APNS proxy is started by apnsProxy command.

$ ./proxy help apnsProxy
NAME
        proxy apnsProxy - starts APNS proxy

SYNOPSIS
        proxy apnsProxy [--apnsKeystore <apnsKeystore>]
                [--apnsKeystoreAlgorithm <apnsKeystoreAlgorithm>]
                [--apnsKeystorePassword <apnsKeystorePassword>]
                [--apnsKeystoreType <apnsKeystoreType>]
                [--apnsMockFeedbackHost <apnsMockFeedbackHost>]
                [--apnsMockFeedbackPort <apnsMockFeedbackPort>]
                [--apnsMockGatewayHost <apnsMockGatewayHost>]
                [--apnsMockGatewayPort <apnsMockGatewayPort>]
                [--notificationEndpointHost <notificationEndpointHost>]
                [--notificationEndpointPort <notificationEndpointPort>]

OPTIONS
        --apnsKeystore <apnsKeystore>
            defaults to serverStore.p12 loaded from the jar

        --apnsKeystoreAlgorithm <apnsKeystoreAlgorithm>
            defaults to sunx509

        --apnsKeystorePassword <apnsKeystorePassword>
            defaults to 123456

        --apnsKeystoreType <apnsKeystoreType>
            defaults to PKCS12

        --apnsMockFeedbackHost <apnsMockFeedbackHost>
            defaults to 127.0.0.1

        --apnsMockFeedbackPort <apnsMockFeedbackPort>
            defaults to 16003

        --apnsMockGatewayHost <apnsMockGatewayHost>
            defaults to 127.0.0.1

        --apnsMockGatewayPort <apnsMockGatewayPort>
            defaults to 16002

        --notificationEndpointHost <notificationEndpointHost>
            defaults to 127.0.0.1

        --notificationEndpointPort <notificationEndpointPort>
            defaults to 17000

FCM proxy

FCM proxy is started by fcmProxy command.

FCM proxy is quite complex to implement due to impossibility of the FCM client library to say where you wish to route the notifications to be sent. You can not set another addresses of FCM notification servers as you can do with APNS client library hence some kind of MITM attack on the certificate level is needed.

$ ./proxy help fcmProxy
NAME
        proxy fcmProxy - starts FCM proxy

SYNOPSIS
        proxy fcmProxy --fcmCertificate <fcmCertificate>
                --fcmCertificateKey <fcmCertificateKey>
                [--fcmMockServerHost <fcmMockServerHost>]
                [--fcmMockServerPort <fcmMockServerPort>]
                [--httpProxyHost <httpProxyHost>] [--httpProxyPort <httpProxyPort>]
                [--notificationEndpointHost <notificationEndpointHost>]
                [--notificationEndpointPort <notificationEndpointPort>]

OPTIONS
        --fcmCertificate <fcmCertificate>


        --fcmCertificateKey <fcmCertificateKey>


        --fcmMockServerHost <fcmMockServerHost>
            defaults to 127.0.0.1

        --fcmMockServerPort <fcmMockServerPort>
            defaults to 16001

        --httpProxyHost <httpProxyHost>
            defaults to 127.0.0.1

        --httpProxyPort <httpProxyPort>
            defaults to 16000

        --notificationEndpointHost <notificationEndpointHost>
            defaults to 127.0.0.1

        --notificationEndpointPort <notificationEndpointPort>
            defaults to 17000

Notification register endpoint

After you send some notifications to this proxy, they are internally cached so you can query the proxy instance what notifications it received so far.

You get these notifications by performing GET on address notificationEndpointHost:notificationEndpointPort.

The received JSON is just serialized model class you find in model artifact.

You can of course unmarshall the JSON at client side into model classes and work with them further as you wish.

You can clear all gathered notifications by calling notificationEndpointHost:notificationEndpointPort/clear.

You can’t perform that action at this time.