调用我们的内部Web服务似乎会出现以下错误:
java.io.IOException: unexpected end of stream on Connection{webservicessandbox.xxx.com:443, proxy=DIRECT@ hostAddress=174.143.185.13 cipherSuite=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA protocol=http/1.1} (recycle count=0)
Run Code Online (Sandbox Code Playgroud)
从我在其他地方看到的,这被指向服务器问题,但是当在浏览器或IOS中调用WS时,我们没有看到这个问题.我已经使用了OkHTTP和手动HTTPUrlConnection实现,它似乎没有任何区别.有没有人有任何想法?
OKHttp:
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.addHeader("Authorization", "Bearer " + apiToken)
.addHeader("content-type", "application/json")
.url(uri)
.build();
HTTPURLConnection:
URL myURL = new URL(uri);
HttpsURLConnection myConnection = (HttpsURLConnection) myURL.openConnection();
myConnection.setConnectTimeout(TIMEOUT_MILLISEC);
myConnection.setDoOutput(false);
myConnection.setRequestMethod("GET");
myConnection.setRequestProperty("Authorization", "Bearer " + apiToken);
myConnection.setRequestProperty("content-type", "application/json");
int respCode = myConnection.getResponseCode();
Run Code Online (Sandbox Code Playgroud) 我得到了一些Scheme代码,并负责将代码转换为Perl.
(define (makecounter)
(let ((x 0)) (lambda () (begin (set! x (+ x 1)) x))))
Run Code Online (Sandbox Code Playgroud)
我知道这应该是一个闭包函数,但是我不能完全理解它应该做的事情.有任何想法吗?