Always Getting

ZW5032

I am trying to perform basic connection using Kite Connect Library:
Note I generated request token by going to Chrome browser with the URL generated "kiteSdk.getLoginUrl()";

Not sure what wrong I am doing. Because exception seems not logical atall. I have perfect internet connection.

Sample Code:

KiteConnect kiteSdk = new KiteConnect(apiKey);

// Set userId.
kiteSdk.setUserId(userId);

String url = kiteSdk.getLoginUrl();

// Get accessToken as follows,
UserModel userModel;
try {

userModel = kiteSdk.requestAccessToken(requestToken, apiSecret);

// Set request token and public token which are obtained from login process.
kiteSdk.setAccessToken(userModel.accessToken);
kiteSdk.setPublicToken(userModel.publicToken);

// Set session expiry callback.
kiteSdk.registerHook(new SessionExpiryHook() {
@Override
public void sessionExpired() {
System.out.println("session expired"); }
});
} catch (JSONException | KiteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

Stack Trace:

18:40:28.524 [main] DEBUG org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: default
18:40:28.566 [main] DEBUG org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context
18:40:28.582 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {s}->https://api.kite.trade:443][total kept alive: 0; route allocated: 0 of 20; total allocated: 0 of 200]
18:40:28.645 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: {s}->https://api.kite.trade:443][total kept alive: 0; route allocated: 1 of 20; total allocated: 1 of 200]
18:40:28.645 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Opening connection {s}->https://api.kite.trade:443
18:40:28.692 [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to api.kite.trade/103.28.140.92:443
18:40:28.692 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Connecting socket to api.kite.trade/103.28.140.92:443 with timeout 10000
18:40:32.687 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2]
18:40:32.693 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, TLS_ECDHE_RSA_WITH_RC4_128_SHA, SSL_RSA_WITH_RC4_128_SHA, TLS_ECDH_ECDSA_WITH_RC4_128_SHA, TLS_ECDH_RSA_WITH_RC4_128_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_RC4_128_MD5, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
18:40:32.693 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Starting handshake
18:40:32.694 [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-0: Shutdown connection
18:40:32.694 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Connection discarded
18:40:32.694 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 0][route: {s}->https://api.kite.trade:443][total kept alive: 0; route allocated: 0 of 20; total allocated: 0 of 200]
18:40:32.694 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Cancelling request execution
18:40:33.180 [Thread-0] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Closing expired connections
18:40:33.182 [Thread-0] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Closing connections idle longer than 30 SECONDS
com.rainmatter.kitehttp.exceptions.KiteNoNetworkException
at com.rainmatter.kitehttp.KiteRequest.postRequest(KiteRequest.java:54)
at com.rainmatter.kiteconnect.KiteConnect.requestAccessToken(KiteConnect.java:181)
at com.amit.stockscreener.KiteConnectTest.kite2(KiteConnectTest.java:32)
at com.amit.stockscreener.KiteConnectTest.main(KiteConnectTest.java:54)
com.rainmatter.kiteconnect.KiteConnect@1e81f160



Sign In or Register to comment.