try (OutputStream os = getSendStream()) {
((Encoder.BinaryStream) encoder).encode(obj, os);
}
completion.onResult(new SendResult());
} else {
throw new EncodeException(obj, sm.getString(
"wsRemoteEndpoint.noEncoder", obj.getClass()));
}
} catch (EncodeException | IOException e) {
SendResult sr = new SendResult(e);
completion.onResult(sr);