Spring Boot Google Drive Api Connection - spring-boot

I am developing one spring boot application where I have to upload files to the google drive.
I have tried to authenticate using GoogleOAuth2Template. Below is code snippet
GoogleOAuth2Template template = new GoogleOAuth2Template(clientId,
clientSecret);
AccessGrant accessGrant =template.authenticateClient();
But when calling authenticateClient() I am getting 404 error.
org.springframework.web.client.HttpClientErrorException: 400 Bad Request
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:700) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:653) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:613) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:531) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.social.google.connect.GoogleOAuth2Template.postForAccessGrant(GoogleOAuth2Template.java:48) ~[spring-social-google-1.0.0.RELEASE.jar:1.0.0.RELEASE]
at org.springframework.social.oauth2.OAuth2Template.authenticateClient(OAuth2Template.java:194) ~[spring-social-core-1.1.0.RELEASE.jar:1.1.0.RELEASE]
at com.cookwala.controller.GoogleDriveController.connectToAPi(GoogleDriveController.java:26) ~[classes/:?]
at com.cookwala.controller.GoogleDriveController$$FastClassBySpringCGLIB$$ffe75835.invoke(<generated>) ~[classes/:?]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:721) ~[spring-aop-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:97) ~[spring-aop-4.3.7.RELEASE.jar:4.3.7.RELEASE]
Also tired calling overloaded method authenticateClient(String scope) , still getting same error.
I am doing above code to get the instance of org.springframework.social.google.api.Google so that can create directory and upload file to Google Drive.
Am I missing something here or is there any other way to get access token from google to connect to google api.

Related

Jmeter response - org.apache.http.NoHttpResponseException: example.com:443 failed to respond

Created a test with the login requests and after some time it stops working. Login request is failed with
org.apache.http.NoHttpResponseException: example.com:443 failed to respond
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141)
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:157)
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:186)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
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.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:939)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:650)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:66)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1301)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1290)
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:651)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:570)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:501)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:268)
at java.base/java.lang.Thread.run(Thread.java:833)
Request details:
Request:
POST https://example.com/auth/token
POST data:
{"scope":"application","grant_type":"sso_token"}
[no cookies]
Request's headers:
Connection: keep-alive
authority: example.com
accept: application/json, text/plain, */*
accept-language: en-US,en;q=0.9
authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6Ii1LSTNROW5OUjdiUm9meG1lWm9YcWJIWkdldyJ9.eyJhdWQiOiIwZGE2MGM0ZDA2LTQ1ZDItYmYxNy1hYTA4ZTE1NDgiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYmQ1OGI3MDgWY0Ni00ZGViLJkNzgtYmI0ZWY4ODU5ZTZhL3YyLjAiLCJpYXQiOjE2NzYyNQ2NzYsIm5iZiI6MTY3NjI3NDY3NiwiZXhwIjoxNjc2Mjc4NTc2LCJhaW8iOiJBVFFBeS84VEFBQUFzSHA3eVZTU1M4bHJvSlUwZm04ZUwwempXSU5ScGppS1hPd3ZPRWN2Q0NhRGpwRE1udVBlVGxnRlFpSGk3c1pUIiwiZW1haWwiOiJBZGVsZVZATTM2NXg4MzUwNTY1MC5Pbk1pY3Jvc29mdC5jb20iLCJuYW1lIjoiQWRlbGUgVmFuY2UiLCJvaWQiOiI1NWQzNjRjMS02MzZlLTRkOTktOTM4ZS1iMTQ0MjdkYTZhZmIiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJBZGVsZVZATTM2NXg4MzUwNTY1MC5Pbk1pY3Jvc29mdC5jb20iLCJyaCI6IjAuQVU0QUNMZFl2VWJ2NjAyOWVMdE8tSVdlYWswTXBnMEdvTkpGdnhlcUNPRldRQWlEQUxjLiIsInN1YiI6InZjQU9nd0xOTWRZV2JZYWFjU3NJWEFPQ0RZYmpyanRHT1ZuUml3Umk5M2ciLCJ0aWQiOiJiZDU4YjcwOC1lZjQ2LTRkZWItYmQ3OC1iYjRlZjg4NTllNmEiLCJ1cG4iOiJBZGVsZVZATTM2NXg4MzUwNTY1MC5Pbk1pY3Jvc29mdC5jb20iLCJ1dGkiOiJHZll1cXJPWVYwQ2xaUzZnMkRFdUFBIiwidmVyIjoiMi4wIn0.V-h8D1TGj9vb2jVwBFGtm3jBH54lfGMOD_xHWYbfornN5ml31K6FnIumMU5i2oBOUcMpDOgM-2_XCbnWPou5iCc_I703kd_zwW6CAgUDBVJtfSmU6Go--hohzMWZuFG7ftKIX0_ftDmRzqJWOw-bwKy5E4NdXImibeKgQsx_N4QFLMx6X9SVDYhf5mXnabkgpdgEn8m2BtM__mYlCJgw7ci6WRuEg6CzocsrKJrNsiUF74vPLkp-tDkbXZFY-1PvNAzAPQEVUZ2kzIXKDf8_O2vd0ozycaz-MVKw6nxOZnYNzXVaTBvkw9sIFMWbW4biZw7GxgrIIC1ux4KvpXuwA
cache-control: no-cache
content-type: application/json
origin: https://example.com_2.net
User-Agent: Apache-HttpClient/4.5.13 (Java/18.0.2.1)
The Bearer is taken from the previous request which works fine, however it's related to the different authorization system. The process is the following - In the Transaction controller I have get Bearer request from one system and with the Bearer authorize in other service.
If I add all information from the request to the Postmen - everything is fine. That's why I assume the problem on the Jmeter side. I tried different clients implementations in the HTTP Advanced tab sampler, reinstalled Java machine.
What do you mean "after some time"?
The error is pretty clear: the host you're trying to test doesn't repond. JMeter sends a HTTP Request and waits for the response and the response.
If the issue is happening under the particular load and cannot be reproduced at lower loads - it clearly indicates the system under test bottleneck and you need to analyze what is the root cause by
checking baseline operating system health metrics like CPU, RAM, Network, Disk usage, etc. It can be done using JMeter PerfMon Plugin
check application and operating system logs on the system under test side
re-run your test with profiler tool telemetry enabled, it will allow you to see what exactly causes the failure
If you cannot successfully execute request even with 1 user in JMeter and can do this in Postman most probably there is a network connectivity issue, like you're behind a corporate proxy which is being detected automatically by Postman. JMeter cannot auto-detect proxies and you need to explicitly set the details via command-line arguments or system properties.

Unable to fetch the metadata : Failed to execute OData Metadata request

I am trying to read data from S4hana cloud.
I configured the destination in cloud foundry where authentication type is OAuth2SAMLBearerAssertion.
and I wrote a little servlet also to get the data using VDM mechanism.
But I am getting below error when I am calling the endpoint
Caused by: com.sap.cloud.sdk.cloudplatform.connectivity.TokenRequestFailedException: Failed to get access token: no valid JWT bearer found in "Authorization" header of request.
2018-10-09T15:34:52.84+0530 [APP/PROC/WEB/0] OUT at com.sap.cloud.sdk.cloudplatform.connectivity.TokenRequest.getCurrentJwt(TokenRequest.java:308)
2018-10-09T15:34:52.84+0530 [APP/PROC/WEB/0] OUT at com.sap.cloud.sdk.cloudplatform.connectivity.TokenRequest.requestTokenWithUserTokenGrant(TokenRequest.java:352)
2018-10-09T15:34:52.84+0530 [APP/PROC/WEB/0] OUT at com.sap.cloud.sdk.cloudplatform.connectivity.XsuaaService.requestAccessToken(XsuaaService.java:135)
2018-10-09T15:34:52.84+0530 [APP/PROC/WEB/0] OUT at com.sap.cloud.sdk.cloudplatform.connectivity.XsuaaService.getServiceToken(XsuaaService.java:197)
2018-10-09T15:34:52.84+0530 [APP/PROC/WEB/0] OUT at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationServiceCommand.getAccessToken(DestinationServiceCommand.java:109)
2018-10-09T15:34:52.84+0530 [APP/PROC/WEB/0] OUT ... 31 common frames omitted
I have followed https://blogs.sap.com/2018/02/05/deep-dive-8-with-sap-s4hana-cloud-sdk-leverage-principal-propagation-via-oauth-2-when-consuming-a-business-api-from-s4hana-cloud/.
Have you setup security / configured an approuter?
The error message indicates a missing JWT in the request.
See also: https://blogs.sap.com/2017/07/18/step-7-with-sap-s4hana-cloud-sdk-secure-your-application-on-sap-cloud-platform-cloudfoundry/

SOA SMPP driver not functioning as well

In our Oracle IDM environment we implemented OTP to send SMS to users.
So we installed SMPP Driver on SOA server with SMS Vendor and everything is ok and OTP is working well.
But when we changed SMS Vendor to another one, the OTP sometimes successes but Mostly fails. Also 'Read Time Out' exception is thrown every 30 second.
Another important thing, when we tried to send SMS to the new vendor using standlone smpp client on the same server it's working fine.
Why the client can send sms perfectly but using SOA server not?
The following Excpetion is shown every 30 second :
<Aug 1, 2017 8:24:48 AM GMT> <Error> <oracle.sdp.messaging.driver.smpp> <SDP-25700> <An unexpected exception was caught.
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at java.net.SocketInputStream.read(SocketInputStream.java:210)
at java.io.DataInputStream.readInt(DataInputStream.java:387)
at oracle.sdpinternal.messaging.driver.smpp.SMPPDriver.readCommand(SMPPDriver.java:715)
at oracle.sdpinternal.messaging.driver.smpp.SMPPDriver.readAnswer(SMPPDriver.java:771)
at oracle.sdpinternal.messaging.driver.smpp.SMPPDriver.access$700(SMPPDriver.java:145)
at oracle.sdpinternal.messaging.driver.smpp.SMPPDriver$SMPPReceivingReader.run(SMPPDriver.java:1813)
at weblogic.connector.security.layer.WorkImpl.runIt(WorkImpl.java:108)
at weblogic.connector.security.layer.WorkImpl.run(WorkImpl.java:44)
at weblogic.connector.work.WorkRequest.run(WorkRequest.java:95)
at weblogic.connector.work.LongRunningWorkRequest.run(LongRunningWorkRequest.java:29)
at java.lang.Thread.run(Thread.java:745)
The following Excpetion is shown when OTP sending is failed :
<Aug 1, 2017 8:25:21 AM GMT> <Error> <oracle.sdp.messaging.driver.smpp> <SDP-25700> <An unexpected exception was caught.
oracle.sdpinternal.messaging.driver.smpp.SMPPDriver$ConnectFailedException: java.net.SocketTimeoutException: Read timed out
at oracle.sdpinternal.messaging.driver.smpp.SMPPDriver.openTransmitterSocket(SMPPDriver.java:2961)
at oracle.sdpinternal.messaging.driver.smpp.SMPPDriver.send(SMPPDriver.java:3146)
at oracle.sdpinternal.messaging.driver.smpp.SMPPDriver.send(SMPPDriver.java:2849)
at oracle.sdpinternal.messaging.driver.smpp.SMPPDriver.send(SMPPDriver.java:2724)
at oracle.sdpinternal.messaging.driver.smpp.SMPPManagedConnection.send(SMPPManagedConnection.java:95)
at oracle.sdpinternal.messaging.driver.DriverConnectionImpl.send(DriverConnectionImpl.java:41)
at oracle.sdpinternal.messaging.dispatcher.DriverDispatcherBean.onMessage(DriverDispatcherBean.java:296)
at sun.reflect.GeneratedMethodAccessor3298.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy507.onMessage(Unknown Source)
at oracle.sdpinternal.messaging.dispatcher.DriverDispatcherBean_xfokw2_MDOImpl.__WL_invoke(Unknown Source)
at weblogic.ejb.container.internal.MDOMethodInvoker.invoke(MDOMethodInvoker.java:35)
at oracle.sdpinternal.messaging.dispatcher.DriverDispatcherBean_xfokw2_MDOImpl.onMessage(Unknown Source)
at oracle.sdpinternal.messaging.jmsmessagereceiver.ResourceAdapterImpl$RaMessageListener.onMessage(ResourceAdapterImpl.java:167)
at oracle.sdpinternal.messaging.jms.QueueWorker.run(QueueWorker.java:73)
at weblogic.work.j2ee.J2EEWorkManager$WorkWithListener.run(J2EEWorkManager.java:184)

HTTPS request not working with Tomcat and SpringBoot

I'm currently trying to get a reverse proxy up and running using Spring Boot and Zuul. The HTTP part is working already. However if I'm trying to request a site via HTTPS e.g. curl https://twitter.com then the request doesn't even reach my implemented logic.
The processing stops in the middle of normalizing the URL, because it looks like this: twitter.com:443. The comment of the relevant code snippet is not that helpful.
// The URL must start with '/'
if (b[start] != (byte) '/') {
return false;
}
I'm using everything without much configuration, just server.port: 9999. Am I missing something here, or why does Tomcat not accept the request?
The relevant Stacktrace:
org.apache.catalina.connector.CoyoteAdapter.normalize(CoyoteAdapter.java:1172)
org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:623)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
Update
In the mean time I figured out the difference. I want to use Zuul as a proxy for both HTTP and HTTPS. However the request that hits the server is not the same as with HTTP but the following:
CONNECT twitter.com:443 HTTP/1.1
Host: twitter.com:443
User-Agent: curl/7.54.1
Proxy-Connection: Keep-Alive
So is it even possible to build a HTTPS proxy using Spring Boot and Zuul?

JMeter java.net.SocketException: Socket closed

I'm developing a JMeter script for an ajax dashboard. The user logs in, navigates to a repository, clicks on the dashboard link, waits for the dashboard to display, and then logs out.
The dashboard has five dashlets. I've come to a point in the script where there are five pairs of samplers, one for each dashlet. The first sampler in each pair has a POST REST request with with ajax in the body. There is a regular expression extractor that extracts an id from the body of the response. This id is added to the URL in the second sampler of the pair, which also has a POST REST request with ajax in the body.
When there are one or two pairs of these samplers the script works 100% of the time, executing the samplers returning HTTP 200 responses and correctly substituting the id extracted from the first sampler in each pair, then logging out in the final sampler (exit.html). When the third pair of samplers are added I get the SocketException about once every 10-15 executions. With four pairs enabled it happens much more frequently, and with the fifth pair enabled it happens 100% of the time.
The odd thing is the SocketException occurs in the logout sampler, no other sampler. Also, if the logout sampler is disabled the socket exception never occurs, it works 100% of the time.
Here's the full stack trace:
java.net.SocketException: Socket closed
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1676)
at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1674)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1672)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1245)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
at org.apache.jmeter.protocol.http.sampler.HTTPJavaImpl.readResponse(HTTPJavaImpl.java:258)
at org.apache.jmeter.protocol.http.sampler.HTTPJavaImpl.sample(HTTPJavaImpl.java:514)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.followRedirects(HTTPSamplerBase.java:1486)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.resultProcessing(HTTPSamplerBase.java:1561)
at org.apache.jmeter.protocol.http.sampler.HTTPAbstractImpl.resultProcessing(HTTPAbstractImpl.java:338)
at org.apache.jmeter.protocol.http.sampler.HTTPJavaImpl.sample(HTTPJavaImpl.java:588)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1141)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1130)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:431)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:258)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.SocketException: Socket closed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:689)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:633)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1324)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:2691)
at java.net.URLConnection.getHeaderFieldLong(URLConnection.java:639)
at java.net.URLConnection.getContentLengthLong(URLConnection.java:511)
at java.net.URLConnection.getContentLength(URLConnection.java:495)
at org.apache.jmeter.protocol.http.sampler.HTTPJavaImpl.readResponse(HTTPJavaImpl.java:224)
... 12 more
I would appreciate any help debugging this
I believe that you're getting Socket Closed error due to changes to HTTP Requests default settings changes including
disabling failing requests
disabling stale check
See Connection Reset since JMeter 2.10 ? wiki page for more detailed explanation and options on how to bypass it if you're absolutely sure that the problem is not with your web server.
Also, sending individual HTTP Requests isn't very correct approach for testing AJAX applications as AJAX assumes kicking off extra requests within the bounds of the same parent thread.Current JMeter implementation doesn't allow overriding parent Thread Group limitation so it isn't possible to spawn more than one request at a time using one thread.
Check out How to Load Test AJAX/XHR Enabled Sites With JMeter guide for options on how to properly test AJAX applications.

Resources