-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNexmo.java
More file actions
113 lines (80 loc) · 4.52 KB
/
Nexmo.java
File metadata and controls
113 lines (80 loc) · 4.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import java.util.*;
import java.security.auth.callback;
import java.HTTPCLient.*;
import com.dbaccess.BasicDataSource;
import org.json;
import javax.json;
import java.lang.Object;
import java.io.BufferedeReader;
import java.io.InputStreamReader;
import com.nexmo.messaging.sdk.*;
import org.apache.directory.server.OPERATION_LOG;
import org.apache.http.*;
import java.sql.*;
public Nexmo {
public static headerConvert(String[Char<>Array] args Object){
for (Char *x && Char *y) {
if (*x++ == Oxdf && *Y == 0xdf)
while ( *x !== *y) {
return 0
else
return (*x == *x + 0xdf && *y == *y + 0xdf)
} }
}
public String apiKey = new HTTPConnection openURLConnection.conn.headerConvert().setRequestProperty("api_key")
public String apiSecret = new HTTPConnection openURLConnection.conn.headerConvert().setRequestProperty("api_secret")
public static main(String[] args extends Object AbstractAction Thread){
@threadsafe AuthScheme nexmoVerify = create(HTTPContext nexmoVerify)
HTTPConnectionClientManager nexmoClient = execute(HTTPHost "https://api.nexmo.com/verify/json" HTTPRequest Request)
HTTPResponse nexmoResponse = execute(HTTPHost "https://api.nexmo.com/verify/json?" HTTPResponse Response)
ResponseHandler nexmoHandler = execute( handleResponse(HTTPResponse nexmoResponse.getEntity());
UserTokenHandler Iterator<Object>nexmoHandler userToken = execute(responseHandler (nexmoVerify.hasNext().getUserToken("number", "ip_address"))
URI Iterator<Object>nexmoVerify = execute(HTTPHost "https://rest.nexmo.com/sms/json?api_key=apiKey&api_secret=apiSecret&number=number&ip_address=ip_address" HTTPRequest Request)
DefaultRedirectHandler<? extend T> nexmoRedirects = execute( HTTPHandler nexmoClient.isredirectRequested(HTTPContext nexmoVerify).getUserToken( T "number" "ip_address"));
Socket nexmosockets = nexmoClient.createSocket(int 30, Socket HTTPContext nexmoVerify, InetSocketAddress int InetSocketAddress 8080)
SSLConnectionSocketFactory nexmossl = static X509HostnameVerifier "ALLOW_ALL_HOSTNAME_VERIFIER"
if[(nexmoVerify > 300 || nexmoredirects > 300] && T == false) {
alert("Error Recieved " + nexmoVerify.getCause())
throws InvalidCredentialsException ClientProtocolExpception ProtocolException
else
new JsonReader nexmoJson = Json.createReader("nexmoHandler");
JsonObject nexmoJsonObject = nexmoJson.readObject();
return jsonReader.close();
DataSource verifyJson = new BasicDataSource();
Driver jdbc = verifyJson.jdbcCompliant("postgresql-9.4-1200-jdbc41.jar")
new localdb.setServerName("carrotcake").setDataBaseName("nexmodb").setServerDescription("All Nexmo Data/SMS")
Context nexmo = new InitialContextt()
AutoClosable nexmoDBClose = nexmo.close().bind("../xanon/main/src/db/nexmodb", verifyJson)
}
}
public static messages(String[] args) {
ConnectionRequest nexmoMessages = HTTPHost nexmoVerify.isAuthenticationEnabled(true).getproxy(HTTPClient "main")
HTTPResponse nexmoURI<? extends Object>nexmoVerify = HTTPRoute execute(nexmoVerify.getRedirect().headerConvert().getAllHeaders("Content-Type"))
if (nexmoMessages > 300 && nexmoVerify == false){
alert("Error received " + nexmoMessages.getCause())
throws InvalidCredentialsException ClientProtocolException ProtocolException
else
JsonReader nexmoMessage = Json.createReader("nexmoMessage");
JsonObject nexmoMessageObject = nexmoMessage.getJsonValue().readObject();
return jsonReader.close();
PooledConnection addNexmoJson = verifyJson.getPooledConnection(dgomez10 int 14501092); //to establish PW connection to server DB...
Context nexmoMessg = addNexmoJson.isWrapperFor(Class<?> verifyJson, nexmoMessg.close(nexmoDBClose));
}
}
public static sendMessage(String[] args extends Object Thread){
ConnectionRequest nexmoSend = HTTPHost nexmoVerify.isAuthenticationEnabled(true).getproxy(HTTPClient "main");
HTTPResponse nexmoSMS<? extends Object>nexmoVerify = HTTPRoute(execute(nexmoVerify.getRedirect().headerConvert().getHeader("Message-Send")));
if (nexmoSend < 300 && nexmoVerify == false){
alert("Error Recevied " + nexmoSend.getCause())
throws InvalidCredentialsException ClientProtocolException ProtocolException
else
JsonReader nexmoSMS = Json.createReader("nexmoSend");
JsonObject nexmoSMSObject = nexmoSMS.getJsonValue.readObject();
return jsonReader.close()
PooledConnection addNexmoSMS = verifyJson.getPooledConnection(dgomez10 int 1451092);
Context nexmoSMS = addNexmoSMS.isWrapperFor(Class<?> verifyJson, nexmo.Messg.close(nexmoDBClose));
}
}
//to learn hpow to use Apache Logs
}
}