use of com.alibaba.rsocket.metadata.RSocketMimeType in project alibaba-rsocket-broker by alibaba.
the class RSocketEncodingFacadeImpl method addEncodingHandler.
private void addEncodingHandler(ObjectEncodingHandler objectEncodingHandler) {
RSocketMimeType mimeType = objectEncodingHandler.mimeType();
handlerMap.put(mimeType, objectEncodingHandler);
}
use of com.alibaba.rsocket.metadata.RSocketMimeType in project alibaba-rsocket-broker by alibaba.
the class RSocketEncodingFacadeImplTest method testEncoding.
@Test
public void testEncoding() {
Map<RSocketMimeType, ByteBuf> store = new HashMap<>();
TempAccount account = new TempAccount(1L, "leijuan", new Date());
for (RSocketMimeType mimeType : mimeTypes) {
ByteBuf byteBuf = encodingFacade.encodingResult(account, mimeType);
store.put(mimeType, byteBuf);
}
for (RSocketMimeType mimeType : mimeTypes) {
TempAccount result = (TempAccount) encodingFacade.decodeResult(mimeType, store.get(mimeType), TempAccount.class);
Assertions.assertNotNull(result);
System.out.println(result.getName());
}
}
Aggregations