cancel
Showing results for 
Search instead for 
Did you mean: 

Java 8 TLS 1.2 anet-sdk sandbox hangs on AIM. ARB is ok.

Hi all,

 

Ive been poking around on this site for a while, because I just can't get our app to work on the sandbox.  It seems that when we do a test transaction using AIM, the connection just hangs and times out. The sandbox shows the AIM transaction as going through, but the 30sec timeout and resulting socketTimeoutException are still happening.  ARB works fine. 

 

My setup:

  • Java 1.8
  • using TLS 1.2 (verified by using wireshark to examine the handshake)
  • httpclient 4.5.3 and httpcore 4.4.6
  • anet-sdk
  • currently running the test code to see if the skd works.
  • Widnows 10 Pro workstation

 

I thought my own code was at fault, so I downloaded the AnetSDK from github.  It had the same socket timeout problem, so I debugged the source.  I discovered a number of deprecated methods  in the HttpUtility, HttpCall and HttpClient classes that the SDK uses.  I rewrote these methods to be compliant with the httpclient and httpcore libraries that the SDK uses, but that didn't help either.

 

My questions:

- is the Sandbox reliable?  Is anyone / HAS anyone had trouble (recently) with the Sandbox processing AIM?

- ARB seeme to be working fine, but I don't know if I can trust that either.

 

What would be a good way to :

- avoid / eliminate the SocketTimeoutException -- my suspicion is that a socket is not being closed after posting, but I can't find it.  The timeout lasts almost exactly 30s, which is the default timeout. The reason it's not in the stack trace below is because I've got debugging turned on and it slows things down.

 

Would love some help here.

 

_Thanks!

 

 

03/10/18 15:34:13,537:  INFO [main] (net.authorize.util.LogHelper:24) - Use Proxy: 'false'
03/10/18 15:34:13,952:  WARN [main] (net.authorize.util.LogHelper:29) - Defaulting to non-proxy environment
java.net.SocketTimeoutException: Read timed out
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
	at java.net.SocketInputStream.read(SocketInputStream.java:171)
	at java.net.SocketInputStream.read(SocketInputStream.java:141)
	at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
	at sun.security.ssl.InputRecord.read(InputRecord.java:503)
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983)
	at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:940)
	at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
	at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
	at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153)
	at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:282)
	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138)
	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
	at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
	at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
	at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165)
	at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
	at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
	at net.authorize.util.HttpClient.execute(HttpClient.java:174)
	at net.authorize.Merchant.postTransaction(Merchant.java:285)
	at net.authorize.aim.functional_test.SimpleAuthCaptureTest.testCreditCardAuthCapture(SimpleAuthCaptureTest.java:67)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
03/10/18 15:34:44,937:  WARN [main] (net.authorize.util.LogHelper:29) - Exception getting response: msg='Read timed out': cause='null', 
StackTrace='[java.net.SocketInputStream.socketRead0(Native Method), java.net.SocketInputStream.socketRead(SocketInputStream.java:116), java.net.SocketInputStream.read(SocketInputStream.java:171), java.net.SocketInputStream.read(SocketInputStream.java:141), sun.security.ssl.InputRecord.readFully(InputRecord.java:465), sun.security.ssl.InputRecord.read(InputRecord.java:503), sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983), sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:940), sun.security.ssl.AppInputStream.read(AppInputStream.java:105), org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137), org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153), org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:282), org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138), org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56), org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259), org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163), org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165), org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273), org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125), org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272), org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185), org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89), org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111), org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185), org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83), org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108), net.authorize.util.HttpClient.execute(HttpClient.java:174), net.authorize.Merchant.postTransaction(Merchant.java:285), net.authorize.aim.functional_test.SimpleAuthCaptureTest.testCreditCardAuthCapture(SimpleAuthCaptureTest.java:67), sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method), sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62), sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.lang.reflect.Method.invoke(Method.java:498), org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44), org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15), org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41), org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20), org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28), org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79), org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71), org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49), org.junit.runners.ParentRunner$3.run(ParentRunner.java:193), org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52), org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191), org.junit.runners.ParentRunner.access$000(ParentRunner.java:42), org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184), org.junit.runners.ParentRunner.run(ParentRunner.java:236), org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86), org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38), org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538), org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760), org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460), org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)]'

 

ship2storage2
Member
1 REPLY 1

More info to add to the above:

 

We decided to test with the PRODUCTION gateway with an invalid cardnumber (4111111111111111 for visa-- which is a test number).  It sailed through and worked.

 

So, I think we can say that it's not the code and its very likely the Sandbox. The sandbox can't be trusted.

Also, we have a few changes to suggest:

  • When using commons logging (or any logging framework for that matter),  you should not wrap the logging function or abstract it -- the way the SDK code is written, the logs will never show which method is executing when the error was thrown and WHERE the error lies.  All you know is that an error did in fact occur, but you don't know where to look, what depended on that error, etc.   You have sit and step through it to find the root cause and fix it.  We'd reccommend that you go with Log4J, SLF4J or use commons logging as it was intended. It'll really help determine the root causes of problems. 
  • The Apache HTTP libraries used (httpclient 4.5.3 and httpcore 4.4.6) have changed their methods / classes and deprecated the ones used here. This has happened way back in version 4.3, and this code uses old methods.  
  • Testing is what enables us to go to production. If the testing environment is different or does not work as anticipated, then we can't trust that what we are developing will work properly. We spent multiple days degraded from production (read: LOSING MONEY) because we didn't know we couldn't trust the Sandbox.  This is NOT good and a very large problem for Authorize.net.  Essentially, because  api changes are not propagated to the Sandbox, we can't test the functionality you demand from us.  For this reason, our management is very seriously considering moving our payment services away form Authorize.net-- which means more work for our developers to integrate some other code base.  We depend on the Sandbox to be a mirror of the production environment -- it would be in everyone's interest to make sure that happens. We don't want to re-code or change, and I'm sure you don't want to lose business.  But we are being forced to do so.

thanks, and I hope you guys can fix teh Sandbox. We really don't want to test in Production

 

ship2storage2
Member