-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
50 additions
and
87 deletions.
There are no files selected for viewing
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
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
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package cn.teaey.apns4j; | ||
|
||
import cn.teaey.apns4j.network.ApnsChannel; | ||
import cn.teaey.apns4j.network.ApnsChannelFactory; | ||
import cn.teaey.apns4j.network.async.ApnsFuture; | ||
import cn.teaey.apns4j.network.async.ApnsService; | ||
import cn.teaey.apns4j.protocol.ApnsPayload; | ||
import org.junit.After; | ||
import org.junit.Test; | ||
|
||
import java.util.concurrent.ExecutionException; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
/** | ||
* @author teaey(xiaofei.wxf) | ||
* @since 1.0.3 | ||
*/ | ||
public class MainTest { | ||
static final ApnsChannelFactory apnsChannelFactory = Apns4j.newChannelFactoryBuilder().keyStoreMeta(TestConts.keyStorePath).keyStorePwd(TestConts.keyStorePwd).build(); | ||
static final ApnsChannel apnsChannel = apnsChannelFactory.newChannel(); | ||
static final ApnsService apnsService = new ApnsService(3, apnsChannelFactory, 3); | ||
public static void main(String[] args) { | ||
ApnsPayload apnsPayload = Apns4j.newPayload() | ||
.alertTitle("Title") | ||
.alertBody("Pushed by apns4j") | ||
.extend("k", "v") | ||
.sound("default"); | ||
//send via channel | ||
apnsChannel.send(TestConts.deviceToken, apnsPayload); | ||
//send async via service | ||
ApnsFuture apnsFuture = apnsService.send(TestConts.deviceToken, apnsPayload); | ||
apnsService.shutdown(3, TimeUnit.SECONDS); | ||
} | ||
} |