Skip to content

Commit

Permalink
remove dead code in ProtoUtil.java.
Browse files Browse the repository at this point in the history
  • Loading branch information
rmehta19 committed Sep 19, 2024
1 parent d13bd88 commit 577b4e5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 67 deletions.
26 changes: 0 additions & 26 deletions s2a/src/main/java/io/grpc/s2a/handshaker/ProtoUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,6 @@

/** Converts proto messages to Netty strings. */
final class ProtoUtil {
/**
* Converts {@link Ciphersuite} to its {@link String} representation.
*
* @param ciphersuite the {@link Ciphersuite} to be converted.
* @return a {@link String} representing the ciphersuite.
* @throws AssertionError if the {@link Ciphersuite} is not one of the supported ciphersuites.
*/
static String convertCiphersuite(Ciphersuite ciphersuite) {
switch (ciphersuite) {
case CIPHERSUITE_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:
return "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256";
case CIPHERSUITE_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:
return "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384";
case CIPHERSUITE_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256:
return "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256";
case CIPHERSUITE_ECDHE_RSA_WITH_AES_128_GCM_SHA256:
return "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256";
case CIPHERSUITE_ECDHE_RSA_WITH_AES_256_GCM_SHA384:
return "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384";
case CIPHERSUITE_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:
return "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256";
default:
throw new AssertionError(
String.format("Ciphersuite %d is not supported.", ciphersuite.getNumber()));
}
}

/**
* Converts a {@link TLSVersion} object to its {@link String} representation.
Expand Down
41 changes: 0 additions & 41 deletions s2a/src/test/java/io/grpc/s2a/handshaker/ProtoUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,47 +30,6 @@
public final class ProtoUtilTest {
@Rule public final Expect expect = Expect.create();

@Test
public void convertCiphersuite_success() {
expect
.that(
ProtoUtil.convertCiphersuite(
Ciphersuite.CIPHERSUITE_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256))
.isEqualTo("TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256");
expect
.that(
ProtoUtil.convertCiphersuite(
Ciphersuite.CIPHERSUITE_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384))
.isEqualTo("TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384");
expect
.that(
ProtoUtil.convertCiphersuite(
Ciphersuite.CIPHERSUITE_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256))
.isEqualTo("TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256");
expect
.that(
ProtoUtil.convertCiphersuite(Ciphersuite.CIPHERSUITE_ECDHE_RSA_WITH_AES_128_GCM_SHA256))
.isEqualTo("TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256");
expect
.that(
ProtoUtil.convertCiphersuite(Ciphersuite.CIPHERSUITE_ECDHE_RSA_WITH_AES_256_GCM_SHA384))
.isEqualTo("TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384");
expect
.that(
ProtoUtil.convertCiphersuite(
Ciphersuite.CIPHERSUITE_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256))
.isEqualTo("TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256");
}

@Test
public void convertCiphersuite_withUnspecifiedCiphersuite_fails() {
AssertionError expected =
assertThrows(
AssertionError.class,
() -> ProtoUtil.convertCiphersuite(Ciphersuite.CIPHERSUITE_UNSPECIFIED));
expect.that(expected).hasMessageThat().isEqualTo("Ciphersuite 0 is not supported.");
}

@Test
public void convertTlsProtocolVersion_success() {
expect
Expand Down

0 comments on commit 577b4e5

Please sign in to comment.