OkCoinStreamingService extends JsonNettyStreamingService { @Override public String getSubscribeMessage(String channelName, Object... args) throws IOException { WebSocketMessage webSocketMessage = new WebSocketMessage("addChannel", channelName); final ObjectMapper mapper = StreamingObjectMapperHelper.getObjectMapper(); return objectMapper.writeValueAsString(webSocketMessage); } OkCoinStreamingService(String apiUrl); @Override Completable connect(); @Override String getSubscribeMessage(String channelName, Object... args); @Override String getUnsubscribeMessage(String channelName);  }
@Test public void testGetSubscribeMessage() throws Exception { String subscribeMessage = streamingService.getSubscribeMessage("ok_sub_spot_btc_usd_depth"); String expected = new String( Files.readAllBytes(Paths.get(ClassLoader.getSystemResource("subscribe.json").toURI()))); assertThat(subscribeMessage).isEqualTo(expected); }