File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
client/src/test/java/org/asynchttpclient Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 15
15
16
16
import static io .netty .handler .codec .http .HttpHeaders .Names .*;
17
17
import static io .netty .handler .codec .http .HttpHeaders .Values .*;
18
- import static java .nio .charset .StandardCharsets .* ;
18
+ import static java .nio .charset .StandardCharsets .ISO_8859_1 ;
19
19
import static java .util .concurrent .TimeUnit .SECONDS ;
20
20
import static org .asynchttpclient .Dsl .*;
21
21
import static org .asynchttpclient .test .TestUtils .*;
41
41
import java .util .concurrent .atomic .AtomicInteger ;
42
42
import java .util .concurrent .atomic .AtomicReference ;
43
43
44
+ import javax .net .ssl .SSLException ;
45
+
44
46
import org .asynchttpclient .cookie .Cookie ;
45
47
import org .asynchttpclient .handler .MaxRedirectException ;
46
48
import org .asynchttpclient .request .body .multipart .StringPart ;
@@ -893,4 +895,20 @@ public void newConnectionEventsAreFired() throws Throwable {
893
895
});
894
896
});
895
897
}
898
+
899
+ @ Test
900
+ public void requestingPlainHttpEndpointOverHttpsThrowsSslException () throws Throwable {
901
+ withClient ().run (client -> {
902
+ withServer (server ).run (server -> {
903
+ server .enqueueEcho ();
904
+ try {
905
+ client .prepareGet (getTargetUrl ().replace ("http" , "https" )).execute ().get ();
906
+ fail ("Request shouldn't succeed" );
907
+ } catch (ExecutionException e ) {
908
+ assertTrue (e .getCause () instanceof ConnectException , "Cause should be a ConnectException" );
909
+ assertTrue (e .getCause ().getCause () instanceof SSLException , "Root cause should be a SslException" );
910
+ }
911
+ });
912
+ });
913
+ }
896
914
}
You can’t perform that action at this time.
0 commit comments