### Question:
Utilities { public static byte[] toUTF8Bytes(String s) { try { return s.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }  static SSLSocketFactory newSSLSocketFactory(InputStream cert, String password,
         String ksType, String ksAlgorithm); static SSLContext newSSLContext(InputStream cert, String password,
         String ksType, String ksAlgorithm); static byte[] decodeHex(String deviceToken); static String encodeHex(byte[] bytes); static byte[] toUTF8Bytes(String s); static byte[] marshall(byte command, byte[] deviceToken, byte[] payload); static byte[] marshallEnhanced(byte command, int identifier,
            int expiryTime, byte[] deviceToken, byte[] payload); static Map<byte[], Integer> parseFeedbackStreamRaw(InputStream in); static Map<String, Date> parseFeedbackStream(InputStream in); static void close(Closeable closeable); static void close(Socket closeable); static void sleep(int delay); static byte[] copyOf(byte[] bytes); static byte[] copyOfRange(byte[] original, int from, int to); static void wrapAndThrowAsRuntimeException(Exception e); static int parseBytes(int b1, int b2, int b3, int b4); static String truncateWhenUTF8(String s, int maxBytes); static final String SANDBOX_GATEWAY_HOST; static final int SANDBOX_GATEWAY_PORT; static final String SANDBOX_FEEDBACK_HOST; static final int SANDBOX_FEEDBACK_PORT; static final String PRODUCTION_GATEWAY_HOST; static final int PRODUCTION_GATEWAY_PORT; static final String PRODUCTION_FEEDBACK_HOST; static final int PRODUCTION_FEEDBACK_PORT; static final int MAX_PAYLOAD_LENGTH; }### Answer:
@Test public void testEncodingUTF8() throws Exception { String m = "我的太阳"; byte[] expected = m.getBytes("utf8"); Assert.assertArrayEquals(expected, Utilities.toUTF8Bytes(m)); }