Search in sources :

Example 1 with UnixIpcService

use of org.web3j.protocol.ipc.UnixIpcService in project besu by hyperledger.

the class Web3JSupportAcceptanceTest method netVersionCall.

@Test
public void netVersionCall() {
    final String osName = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
    assumeTrue(osName.contains("mac") || osName.contains("linux"));
    final Web3j web3 = Web3j.build(new UnixIpcService(socketPath.toString()));
    final Request<?, NetVersion> ethBlockNumberRequest = web3.netVersion();
    node.verify(node -> {
        try {
            assertThat(ethBlockNumberRequest.send().getNetVersion()).isEqualTo(String.valueOf(2018));
        } catch (IOException e) {
            fail("Web3J net_version call failed", e);
        }
    });
}
Also used : Web3j(org.web3j.protocol.Web3j) UnixIpcService(org.web3j.protocol.ipc.UnixIpcService) IOException(java.io.IOException) NetVersion(org.web3j.protocol.core.methods.response.NetVersion) Test(org.junit.Test)

Aggregations

IOException (java.io.IOException)1 Test (org.junit.Test)1 Web3j (org.web3j.protocol.Web3j)1 NetVersion (org.web3j.protocol.core.methods.response.NetVersion)1 UnixIpcService (org.web3j.protocol.ipc.UnixIpcService)1