|
2 | 2 |
|
3 | 3 | import java.io.ByteArrayInputStream; |
4 | 4 | import java.io.ByteArrayOutputStream; |
5 | | -import java.io.EOFException; |
6 | 5 | import java.io.FileReader; |
7 | 6 | import java.io.IOException; |
8 | 7 | import java.io.InputStream; |
|
43 | 42 | import org.bouncycastle.est.Source; |
44 | 43 | import org.bouncycastle.est.jcajce.JcaJceUtils; |
45 | 44 | import org.bouncycastle.est.jcajce.JsseESTServiceBuilder; |
46 | | -import org.bouncycastle.jsse.provider.BouncyCastleJsseProvider; |
47 | 45 | import org.bouncycastle.test.est.examples.ExampleUtils; |
48 | 46 | import org.bouncycastle.util.Store; |
49 | 47 | import org.bouncycastle.util.io.pem.PemReader; |
@@ -152,7 +150,7 @@ public void testFetchCaCertsWithTimeout() |
152 | 150 |
|
153 | 151 | int port = res.open(null); |
154 | 152 |
|
155 | | - ESTService est = new JsseESTServiceBuilder("localhost:" + port , JcaJceUtils.getTrustAllTrustManager()).withTimeout(500).addCipherSuites(res.getEnabledSuites()).build(); |
| 153 | + ESTService est = new JsseESTServiceBuilder("localhost:" + port, JcaJceUtils.getTrustAllTrustManager()).withTimeout(500).addCipherSuites(res.getEnabledSuites()).build(); |
156 | 154 |
|
157 | 155 | try |
158 | 156 | { |
@@ -259,8 +257,6 @@ public void testFetchCaCertsWithBogusTrustAnchor() |
259 | 257 | } |
260 | 258 |
|
261 | 259 |
|
262 | | - |
263 | | - |
264 | 260 | /** |
265 | 261 | * Fetch CA certs relying on TLS to validate the server by specifying a trust anchor. |
266 | 262 | * |
@@ -684,7 +680,7 @@ public boolean isTrusted() |
684 | 680 | catch (Exception ex) |
685 | 681 | { |
686 | 682 | Assert.assertEquals("Expect EST Exception", ESTException.class, ex.getClass()); |
687 | | - Assert.assertEquals("Expect cause an IOException", EOFException.class, ex.getCause().getClass()); |
| 683 | + Assert.assertTrue("Expect cause an IOException", ex.getCause() instanceof IOException); |
688 | 684 | } |
689 | 685 |
|
690 | 686 | } |
@@ -835,7 +831,7 @@ public void testEmptyCaCertsResponseContentLengthExceedsAbsoluteLimit() |
835 | 831 |
|
836 | 832 |
|
837 | 833 | JsseESTServiceBuilder builder = new JsseESTServiceBuilder( |
838 | | - "localhost:" + port , JcaJceUtils.getTrustAllTrustManager()); |
| 834 | + "localhost:" + port, JcaJceUtils.getTrustAllTrustManager()); |
839 | 835 |
|
840 | 836 |
|
841 | 837 | builder.withReadLimit(1000L); |
@@ -903,7 +899,7 @@ public void testContentLengthBelowAbsoluteLimit() |
903 | 899 | int port = res.open(responseData.toByteArray()); |
904 | 900 |
|
905 | 901 | JsseESTServiceBuilder builder = new JsseESTServiceBuilder( |
906 | | - "localhost:" + port , JcaJceUtils.getTrustAllTrustManager()); |
| 902 | + "localhost:" + port, JcaJceUtils.getTrustAllTrustManager()); |
907 | 903 | builder.withReadLimit(530); |
908 | 904 | builder.addCipherSuites(res.getEnabledSuites()); |
909 | 905 |
|
@@ -960,7 +956,7 @@ public void testResponseContentLengthInvalid() |
960 | 956 |
|
961 | 957 | int port = res.open(responseData.toByteArray()); |
962 | 958 | JsseESTServiceBuilder builder = new JsseESTServiceBuilder( |
963 | | - "localhost:" + port , JcaJceUtils.getTrustAllTrustManager()); |
| 959 | + "localhost:" + port, JcaJceUtils.getTrustAllTrustManager()); |
964 | 960 | builder.withReadLimit(530); |
965 | 961 | builder.addCipherSuites(res.getSupportedCipherSuites()); |
966 | 962 |
|
@@ -1023,7 +1019,7 @@ public void testResponseNoContentLengthHeader() |
1023 | 1019 |
|
1024 | 1020 | int port = res.open(responseData.toByteArray()); |
1025 | 1021 | JsseESTServiceBuilder builder = new JsseESTServiceBuilder( |
1026 | | - "localhost:" + port , JcaJceUtils.getTrustAllTrustManager()); |
| 1022 | + "localhost:" + port, JcaJceUtils.getTrustAllTrustManager()); |
1027 | 1023 | builder.withReadLimit(530); |
1028 | 1024 | builder.addCipherSuites(res.getSupportedCipherSuites()); |
1029 | 1025 |
|
@@ -1088,7 +1084,7 @@ public void testResponseNegativeContentLength() |
1088 | 1084 | int port = res.open(responseData.toByteArray()); |
1089 | 1085 |
|
1090 | 1086 | JsseESTServiceBuilder builder = new JsseESTServiceBuilder( |
1091 | | - "localhost:" + port , JcaJceUtils.getTrustAllTrustManager()); |
| 1087 | + "localhost:" + port, JcaJceUtils.getTrustAllTrustManager()); |
1092 | 1088 | builder.withReadLimit(530); |
1093 | 1089 | builder.addCipherSuites(res.getSupportedCipherSuites()); |
1094 | 1090 |
|
@@ -1150,7 +1146,7 @@ public void testIncorrectContentType() |
1150 | 1146 |
|
1151 | 1147 | int port = res.open(responseData.toByteArray()); |
1152 | 1148 | JsseESTServiceBuilder builder = new JsseESTServiceBuilder( |
1153 | | - "localhost:" + port , JcaJceUtils.getTrustAllTrustManager()); |
| 1149 | + "localhost:" + port, JcaJceUtils.getTrustAllTrustManager()); |
1154 | 1150 | builder.withReadLimit(530); |
1155 | 1151 | builder.addCipherSuites(res.getSupportedCipherSuites()); |
1156 | 1152 |
|
@@ -1212,7 +1208,7 @@ public void testMissingContentType() |
1212 | 1208 |
|
1213 | 1209 | int port = res.open(responseData.toByteArray()); |
1214 | 1210 | JsseESTServiceBuilder builder = new JsseESTServiceBuilder( |
1215 | | - "localhost:" + port , JcaJceUtils.getTrustAllTrustManager()); |
| 1211 | + "localhost:" + port, JcaJceUtils.getTrustAllTrustManager()); |
1216 | 1212 | builder.withReadLimit(530); |
1217 | 1213 | builder.addCipherSuites(res.getSupportedCipherSuites()); |
1218 | 1214 |
|
@@ -1277,7 +1273,7 @@ public void testRejectOnTLSv1Establishment() |
1277 | 1273 | int port = res.open(responseData.toByteArray()); |
1278 | 1274 |
|
1279 | 1275 | JsseESTServiceBuilder builder = new JsseESTServiceBuilder( |
1280 | | - "localhost:" + port , JcaJceUtils.getTrustAllTrustManager()); |
| 1276 | + "localhost:" + port, JcaJceUtils.getTrustAllTrustManager()); |
1281 | 1277 | builder.withReadLimit(530); |
1282 | 1278 | builder.addCipherSuites(res.getSupportedCipherSuites()); |
1283 | 1279 | builder.withTLSVersion("TLSv1"); |
@@ -1351,7 +1347,7 @@ public void testRejectOnNullCipherEstablishment() |
1351 | 1347 | { |
1352 | 1348 | int port = res.open(responseData.toByteArray()); |
1353 | 1349 | JsseESTServiceBuilder builder = new JsseESTServiceBuilder( |
1354 | | - "127.0.0.1:" + port , JcaJceUtils.getTrustAllTrustManager()); |
| 1350 | + "127.0.0.1:" + port, JcaJceUtils.getTrustAllTrustManager()); |
1355 | 1351 | builder.withReadLimit(530).withHostNameAuthorizer(null); |
1356 | 1352 | builder.addCipherSuites(res.getEnabledSuites()); |
1357 | 1353 |
|
@@ -1442,7 +1438,7 @@ public void testRejectOnAnonCipherEstablishment() |
1442 | 1438 | catch (Exception ex) |
1443 | 1439 | { |
1444 | 1440 | Assert.assertEquals("EST Exception", ESTException.class, ex.getClass()); |
1445 | | - Assert.assertTrue("", ex.getCause() instanceof IOException); |
| 1441 | + Assert.assertTrue("", ex.getCause() instanceof IOException); |
1446 | 1442 | Assert.assertTrue(ex.getMessage().contains("must not use anon")); |
1447 | 1443 | } |
1448 | 1444 | } |
@@ -1618,7 +1614,7 @@ public void testRejectOnDESCipherEstablishment() |
1618 | 1614 | int port = res.open(responseData.toByteArray()); |
1619 | 1615 |
|
1620 | 1616 | JsseESTServiceBuilder builder = new JsseESTServiceBuilder( |
1621 | | - "127.0.0.1:" + port , JcaJceUtils.getTrustAllTrustManager()); |
| 1617 | + "127.0.0.1:" + port, JcaJceUtils.getTrustAllTrustManager()); |
1622 | 1618 | builder.withReadLimit(530); |
1623 | 1619 | builder.addCipherSuites(res.getEnabledSuites()); |
1624 | 1620 | builder.withTLSVersion("TLSv1"); // <- needed to get export suites to work. |
|
0 commit comments