Created
March 8, 2016 08:13
-
-
Save luciferous/8f98fd3367af7d2aa7ef to your computer and use it in GitHub Desktop.
Test socket closed by remote
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while true; do printf 'HTTP/1.1 200 OK\r\nServer: test\r\n'|nc -l 3000; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.twitter.finagle.Http | |
import com.twitter.finagle.http.{Http => _, _} | |
import com.twitter.io.{Buf, Reader} | |
import com.twitter.util.Await | |
val tls = Http.client.withStreaming(enabled=true).withTlsWithoutValidation.newService("localhost:4433") | |
val plain = Http.client.withStreaming(enabled=true).newService("localhost:3000") | |
val tlsReq = Request(Version.Http11, Method.Get, "/", Reader.writable()) | |
val tlsRes = Await.result(tls(tlsReq).liftToTry) | |
println("TLS response failed? " + tlsRes.isThrow) | |
val plainReq = Request(Version.Http11, Method.Get, "/", Reader.writable()) | |
val plainRes = Await.result(plain(plainReq).liftToTry) | |
println("TLS response failed? " + plainRes.isThrow) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while true; do printf 'HTTP/1.1 200 OK\r\nServer: test\r\n'|openssl s_server; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment