public static byte[] signMessage(RawTransaction rawTransaction, Credentials credentials) {
        byte[] encodedTransaction;
        if (rawTransaction.getTransaction().getType().isEip4844()) {
            encodedTransaction = encode4844(rawTransaction);
        } else {
            encodedTransaction = encode(rawTransaction);
        }
        Sign.SignatureData signatureData =
                Sign.signMessage(encodedTransaction, credentials.getEcKeyPair());

        return encode(rawTransaction, signatureData);
    }
@Test
    public void testSignMessage() {
        byte[] signedMessage =
                TransactionEncoder.signMessage(createEtherTransaction(), SampleKeys.CREDENTIALS);
        String hexMessage = Numeric.toHexString(signedMessage);

        assertEquals(
                hexMessage,
                ("0xf85580010a840add5355887fffffffffffffff80"
                        + "1c"
                        + "a046360b50498ddf5566551ce1ce69c46c565f1f478bb0ee680caf31fbc08ab727"
                        + "a01b2f1432de16d110407d544f519fc91b84c8e16d3b6ec899592d486a94974cd0"));
    }