public String sign(RawTransaction rawTransaction) {

        byte[] signedMessage = txSignService.sign(rawTransaction, chainId);

        return Numeric.toHexString(signedMessage);
    }
@Test
    public void testSignRawTxWithHSM() throws IOException {
        TransactionReceipt transactionReceipt = prepareTransfer();
        prepareTransaction(transactionReceipt);

        OkHttpClient okHttpClient = mock(OkHttpClient.class);
        Call call = mock(Call.class);
        Response hmsResponse =
                new Response.Builder()
                        .code(200)
                        .request(new Request.Builder().url("http://test-call.com").build())
                        .protocol(Protocol.HTTP_1_1)
                        .message("response message")
                        .body(
                                ResponseBody.create(
                                        TX_SIGN_FORMAT_DER_HEX, MediaType.parse("text/plain")))
                        .build();

        when(call.execute()).thenReturn(hmsResponse);
        when(okHttpClient.newCall(any())).thenReturn(call);

        HSMHTTPRequestProcessor<HSMHTTPPass> hsmRequestProcessor =
                new HSMHTTPRequestProcessorTestImpl<>(okHttpClient);
        HSMHTTPPass hsmhttpPass =
                new HSMHTTPPass(
                        SampleKeys.CREDENTIALS.getAddress(),
                        SampleKeys.CREDENTIALS.getEcKeyPair().getPublicKey(),
                        "http://mock_request_url.com");

        TxSignService txHSMSignService = new TxHSMSignService<>(hsmRequestProcessor, hsmhttpPass);
        RawTransactionManager transactionManager =
                new RawTransactionManager(web3j, txHSMSignService, ChainId.NONE);

        String sign = transactionManager.sign(createRawTx());

        assertEquals(TX_SIGN_RESULT_HEX, sign);
    }