Skip to content

Commit 858448f

Browse files
committed
minor clean up
1 parent 03ecb4d commit 858448f

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

client/src/main/java/org/asynchttpclient/ws/WebSocketUtils.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
*/
1414
package org.asynchttpclient.ws;
1515

16+
import static java.nio.charset.StandardCharsets.US_ASCII;
17+
1618
import java.io.UnsupportedEncodingException;
1719
import java.security.MessageDigest;
1820
import java.security.NoSuchAlgorithmException;
@@ -24,13 +26,13 @@ public final class WebSocketUtils {
2426

2527
public static String getKey() {
2628
byte[] nonce = createRandomBytes(16);
27-
return base64Encode(nonce);
29+
return Base64.encode(nonce);
2830
}
2931

3032
public static String getAcceptKey(String key) throws UnsupportedEncodingException {
3133
String acceptSeed = key + MAGIC_GUID;
32-
byte[] sha1 = sha1(acceptSeed.getBytes("US-ASCII"));
33-
return base64Encode(sha1);
34+
byte[] sha1 = sha1(acceptSeed.getBytes(US_ASCII));
35+
return Base64.encode(sha1);
3436
}
3537

3638
public static byte[] md5(byte[] bytes) {
@@ -51,10 +53,6 @@ public static byte[] sha1(byte[] bytes) {
5153
}
5254
}
5355

54-
public static String base64Encode(byte[] bytes) {
55-
return Base64.encode(bytes);
56-
}
57-
5856
public static byte[] createRandomBytes(int size) {
5957
byte[] bytes = new byte[size];
6058

@@ -70,4 +68,3 @@ public static int createRandomNumber(int min, int max) {
7068
}
7169

7270
}
73-

0 commit comments

Comments
 (0)