@@ -20,6 +20,7 @@ public void testParseSslForm() {
2020 assertEquals ("secret" , opts .getPassword ());
2121 assertEquals ("TLSv1.2,TLSv1.3" , opts .getProtocols ());
2222 assertEquals ("TLS_RSA_WITH_AES_128_GCM_SHA256" , opts .getCipherSuites ());
23+ assertEquals ("" , opts .getPinnedClientTrust ());
2324 }
2425
2526 @ Test
@@ -33,6 +34,49 @@ public void testParseUsernameFormWithSsl() {
3334 assertEquals ("pw" , opts .getPassword ());
3435 assertEquals ("TLSv1.2" , opts .getProtocols ());
3536 assertEquals ("CIPHER" , opts .getCipherSuites ());
37+ assertEquals ("" , opts .getPinnedClientTrust ());
38+ }
39+
40+ @ Test
41+ public void testParseSslFormWithPinnedClientTrust () {
42+ String [] args = new String [] { "https://example:8443" , "1.0" , "-ssl" , "TLSv1.2,TLSv1.3" , "TLS_RSA_WITH_AES_128_GCM_SHA256" , "alice" , "secret" , "-trust" , "abcdef1234,5489349" };
43+ CommandLineOptions opts = new CommandLineOptions (args );
44+
45+ assertEquals ("https://example:8443" , opts .getServer ());
46+ assertEquals ("1.0" , opts .getVersion ());
47+ assertEquals ("alice" , opts .getUsername ());
48+ assertEquals ("secret" , opts .getPassword ());
49+ assertEquals ("TLSv1.2,TLSv1.3" , opts .getProtocols ());
50+ assertEquals ("TLS_RSA_WITH_AES_128_GCM_SHA256" , opts .getCipherSuites ());
51+ assertEquals ("abcdef1234,5489349" , opts .getPinnedClientTrust ());
52+ }
53+
54+ @ Test
55+ public void testParseUsernameFormWithPinnedClientTrust () {
56+ String [] args = new String [] { "https://example:8443" , "1.0" , "bob" , "pw" , "-trust" , "localhost,a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3" };
57+ CommandLineOptions opts = new CommandLineOptions (args );
58+
59+ assertEquals ("https://example:8443" , opts .getServer ());
60+ assertEquals ("1.0" , opts .getVersion ());
61+ assertEquals ("bob" , opts .getUsername ());
62+ assertEquals ("pw" , opts .getPassword ());
63+ assertEquals ("" , opts .getProtocols ());
64+ assertEquals ("" , opts .getCipherSuites ());
65+ assertEquals ("localhost,a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3" , opts .getPinnedClientTrust ());
66+ }
67+
68+ @ Test
69+ public void testParsePinnedClientTrustAfterredentials () {
70+ String [] args = new String [] { "https://example:8443" , "1.0" , "bob" , "pw" , "-trust" , "localhost,a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3" };
71+ CommandLineOptions opts = new CommandLineOptions (args );
72+
73+ assertEquals ("https://example:8443" , opts .getServer ());
74+ assertEquals ("1.0" , opts .getVersion ());
75+ assertEquals ("bob" , opts .getUsername ());
76+ assertEquals ("pw" , opts .getPassword ());
77+ assertEquals ("" , opts .getProtocols ());
78+ assertEquals ("" , opts .getCipherSuites ());
79+ assertEquals ("localhost,a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3" , opts .getPinnedClientTrust ());
3680 }
3781
3882 @ Test
@@ -45,6 +89,7 @@ public void testNullArgsUsesDefaults() {
4589 assertEquals ("" , opts .getPassword ());
4690 assertEquals ("" , opts .getProtocols ());
4791 assertEquals ("" , opts .getCipherSuites ());
92+ assertEquals ("" , opts .getPinnedClientTrust ());
4893 }
4994
5095 @ Test
@@ -58,5 +103,6 @@ public void testNormal() {
58103 assertEquals ("" , opts .getPassword ());
59104 assertEquals ("" , opts .getProtocols ());
60105 assertEquals ("" , opts .getCipherSuites ());
106+ assertEquals ("" , opts .getPinnedClientTrust ());
61107 }
62108}
0 commit comments