Skip to content

Commit 1e8485c

Browse files
committed
Remove dead code in ProtoUtil.java.
1 parent d13bd88 commit 1e8485c

File tree

2 files changed

+1
-67
lines changed

2 files changed

+1
-67
lines changed

s2a/src/main/java/io/grpc/s2a/handshaker/ProtoUtil.java

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,7 @@
2020

2121
/** Converts proto messages to Netty strings. */
2222
final class ProtoUtil {
23-
/**
24-
* Converts {@link Ciphersuite} to its {@link String} representation.
25-
*
26-
* @param ciphersuite the {@link Ciphersuite} to be converted.
27-
* @return a {@link String} representing the ciphersuite.
28-
* @throws AssertionError if the {@link Ciphersuite} is not one of the supported ciphersuites.
29-
*/
30-
static String convertCiphersuite(Ciphersuite ciphersuite) {
31-
switch (ciphersuite) {
32-
case CIPHERSUITE_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:
33-
return "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256";
34-
case CIPHERSUITE_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:
35-
return "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384";
36-
case CIPHERSUITE_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256:
37-
return "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256";
38-
case CIPHERSUITE_ECDHE_RSA_WITH_AES_128_GCM_SHA256:
39-
return "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256";
40-
case CIPHERSUITE_ECDHE_RSA_WITH_AES_256_GCM_SHA384:
41-
return "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384";
42-
case CIPHERSUITE_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:
43-
return "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256";
44-
default:
45-
throw new AssertionError(
46-
String.format("Ciphersuite %d is not supported.", ciphersuite.getNumber()));
47-
}
48-
}
23+
4924

5025
/**
5126
* Converts a {@link TLSVersion} object to its {@link String} representation.

s2a/src/test/java/io/grpc/s2a/handshaker/ProtoUtilTest.java

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -30,47 +30,6 @@
3030
public final class ProtoUtilTest {
3131
@Rule public final Expect expect = Expect.create();
3232

33-
@Test
34-
public void convertCiphersuite_success() {
35-
expect
36-
.that(
37-
ProtoUtil.convertCiphersuite(
38-
Ciphersuite.CIPHERSUITE_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256))
39-
.isEqualTo("TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256");
40-
expect
41-
.that(
42-
ProtoUtil.convertCiphersuite(
43-
Ciphersuite.CIPHERSUITE_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384))
44-
.isEqualTo("TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384");
45-
expect
46-
.that(
47-
ProtoUtil.convertCiphersuite(
48-
Ciphersuite.CIPHERSUITE_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256))
49-
.isEqualTo("TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256");
50-
expect
51-
.that(
52-
ProtoUtil.convertCiphersuite(Ciphersuite.CIPHERSUITE_ECDHE_RSA_WITH_AES_128_GCM_SHA256))
53-
.isEqualTo("TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256");
54-
expect
55-
.that(
56-
ProtoUtil.convertCiphersuite(Ciphersuite.CIPHERSUITE_ECDHE_RSA_WITH_AES_256_GCM_SHA384))
57-
.isEqualTo("TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384");
58-
expect
59-
.that(
60-
ProtoUtil.convertCiphersuite(
61-
Ciphersuite.CIPHERSUITE_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256))
62-
.isEqualTo("TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256");
63-
}
64-
65-
@Test
66-
public void convertCiphersuite_withUnspecifiedCiphersuite_fails() {
67-
AssertionError expected =
68-
assertThrows(
69-
AssertionError.class,
70-
() -> ProtoUtil.convertCiphersuite(Ciphersuite.CIPHERSUITE_UNSPECIFIED));
71-
expect.that(expected).hasMessageThat().isEqualTo("Ciphersuite 0 is not supported.");
72-
}
73-
7433
@Test
7534
public void convertTlsProtocolVersion_success() {
7635
expect

0 commit comments

Comments
 (0)