Skip to content

Instantly share code, notes, and snippets.

View silvestrpredko's full-sized avatar
🇺🇦

Predko Silvestr silvestrpredko

🇺🇦
  • Ukraine
  • 05:12 (UTC +03:00)
View GitHub Profile
@silvestrpredko
silvestrpredko / transport.rs
Created July 5, 2023 14:41
ChannelTransport
pub struct ChannelTransport {
rx: UnboundedReceiver<Vec<u8>>,
tx: UnboundedSender<Vec<u8>>,
}
type TransportImpl = Transport<ChannelTransport, Vec<u8>, Vec<u8>, Bincode<Vec<u8>, Vec<u8>>>;
impl ChannelTransport {
pub fn new() -> (
TransportImpl,
@silvestrpredko
silvestrpredko / InterceptRequest.java
Last active April 10, 2020 13:48
Append parameters to POST in Intercept(OkHttp)
/**
* @param parameter - this is string that contains parameters for Http POST
* @param request - old Request
* @return - new {@link Request} with additional parameters
* */
public static Request interceptRequest(@NotNull Request request, @NotNull String parameter)
throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();