Search in sources :

Example 1 with Reply

use of com.github.jh3nd3rs0n.jargyle.transport.socks5.Reply in project jargyle by jh3nd3rs0n.

the class Socks5Client method receiveSocks5Reply.

protected Socks5Reply receiveSocks5Reply(final Socket connectedInternalSocket) throws IOException {
    Socks5Reply socks5Rep = null;
    try {
        InputStream inputStream = connectedInternalSocket.getInputStream();
        socks5Rep = Socks5Reply.newInstanceFrom(inputStream);
    } catch (IOException e) {
        SocksClientExceptionThrowingHelper.throwAsSocksClientException(e, this);
    }
    Reply reply = socks5Rep.getReply();
    if (!reply.equals(Reply.SUCCEEDED)) {
        throw new FailureSocks5ReplyException(this, socks5Rep);
    }
    return socks5Rep;
}
Also used : InputStream(java.io.InputStream) Socks5Reply(com.github.jh3nd3rs0n.jargyle.transport.socks5.Socks5Reply) Reply(com.github.jh3nd3rs0n.jargyle.transport.socks5.Reply) Socks5Reply(com.github.jh3nd3rs0n.jargyle.transport.socks5.Socks5Reply) IOException(java.io.IOException) UncheckedIOException(java.io.UncheckedIOException)

Example 2 with Reply

use of com.github.jh3nd3rs0n.jargyle.transport.socks5.Reply in project 91Pop by DanteAndroid.

the class AppApiHelper method action.

private Observable<BaseResult<List<MeiZiTu>>> action(Observable<String> stringObservable, String tag, final int page, final boolean pullToRefresh) {
    DynamicKeyGroup dynamicKeyGroup = new DynamicKeyGroup(tag, page);
    EvictDynamicKeyGroup evictDynamicKeyGroup = new EvictDynamicKeyGroup(pullToRefresh);
    return cacheProviders.meiZiTu(stringObservable, dynamicKeyGroup, evictDynamicKeyGroup).map(new Function<Reply<String>, String>() {

        @Override
        public String apply(Reply<String> stringReply) throws Exception {
            return stringReply.getData();
        }
    }).map(new Function<String, BaseResult<List<MeiZiTu>>>() {

        @Override
        public BaseResult<List<MeiZiTu>> apply(String s) throws Exception {
            return ParseMeiZiTu.parseMzPosts(s, page);
        }
    });
}
Also used : Function(io.reactivex.functions.Function) BaseResult(com.dante.data.model.BaseResult) Reply(io.rx_cache2.Reply) EvictDynamicKeyGroup(io.rx_cache2.EvictDynamicKeyGroup) DynamicKeyGroup(io.rx_cache2.DynamicKeyGroup) EvictDynamicKeyGroup(io.rx_cache2.EvictDynamicKeyGroup) MeiZiTu(com.dante.data.model.MeiZiTu) ParseMeiZiTu(com.dante.parser.ParseMeiZiTu) FavoriteException(com.dante.exception.FavoriteException) MessageException(com.dante.exception.MessageException)

Example 3 with Reply

use of com.github.jh3nd3rs0n.jargyle.transport.socks5.Reply in project 91Pop by DanteAndroid.

the class AppApiHelper method list99Mm.

@Override
public Observable<BaseResult<List<Mm99>>> list99Mm(String category, final int page, boolean cleanCache) {
    String url = buildUrl(category, page);
    DynamicKeyGroup dynamicKeyGroup = new DynamicKeyGroup(category, page);
    EvictDynamicKeyGroup evictDynamicKeyGroup = new EvictDynamicKeyGroup(cleanCache);
    return cacheProviders.cacheWithLimitTime(mm99ServiceApi.imageList(url), dynamicKeyGroup, evictDynamicKeyGroup).map(new Function<Reply<String>, String>() {

        @Override
        public String apply(Reply<String> stringReply) {
            return stringReply.getData();
        }
    }).map(new Function<String, BaseResult<List<Mm99>>>() {

        @Override
        public BaseResult<List<Mm99>> apply(String s) {
            return Parse99Mm.parse99MmList(s, page);
        }
    });
}
Also used : Function(io.reactivex.functions.Function) BaseResult(com.dante.data.model.BaseResult) Mm99(com.dante.data.model.Mm99) Reply(io.rx_cache2.Reply) EvictDynamicKeyGroup(io.rx_cache2.EvictDynamicKeyGroup) DynamicKeyGroup(io.rx_cache2.DynamicKeyGroup) EvictDynamicKeyGroup(io.rx_cache2.EvictDynamicKeyGroup)

Example 4 with Reply

use of com.github.jh3nd3rs0n.jargyle.transport.socks5.Reply in project 91Pop by DanteAndroid.

the class AppApiHelper method loadPorn91MyFavoriteVideos.

@Override
public Observable<BaseResult<List<UnLimit91PornItem>>> loadPorn91MyFavoriteVideos(String userName, int page, boolean cleanCache) {
    Observable<String> favoriteObservable = noLimit91PornServiceApi.myFavoriteVideo(page, HeaderUtils.getIndexHeader(addressHelper));
    DynamicKeyGroup dynamicKeyGroup = new DynamicKeyGroup(userName, page);
    EvictDynamicKey evictDynamicKey = new EvictDynamicKey(cleanCache);
    return cacheProviders.getFavorite(favoriteObservable, dynamicKeyGroup, evictDynamicKey).map(new Function<Reply<String>, String>() {

        @Override
        public String apply(Reply<String> responseBody) throws Exception {
            return responseBody.getData();
        }
    }).map(new Function<String, BaseResult<List<UnLimit91PornItem>>>() {

        @Override
        public BaseResult<List<UnLimit91PornItem>> apply(String s) throws Exception {
            return Parse91PronVideo.parseMyFavorite(s);
        }
    });
}
Also used : Function(io.reactivex.functions.Function) BaseResult(com.dante.data.model.BaseResult) EvictDynamicKey(io.rx_cache2.EvictDynamicKey) Reply(io.rx_cache2.Reply) EvictDynamicKeyGroup(io.rx_cache2.EvictDynamicKeyGroup) DynamicKeyGroup(io.rx_cache2.DynamicKeyGroup) UnLimit91PornItem(com.dante.data.model.UnLimit91PornItem) FavoriteException(com.dante.exception.FavoriteException) MessageException(com.dante.exception.MessageException)

Example 5 with Reply

use of com.github.jh3nd3rs0n.jargyle.transport.socks5.Reply in project RxCache by VictorAlbertos.

the class ProcessorProvidersTest method When_Evict_Cache_Then_Source_Retrieved_Is_Cloud.

@Test
public void When_Evict_Cache_Then_Source_Retrieved_Is_Cloud() {
    TestObserver observerMock = getSubscriberCompleted(true, true, true, Loader.VALID, false);
    Reply<Mock> reply = (Reply) observerMock.values().get(0);
    assertThat(reply.getSource(), is(Source.CLOUD));
    assertNotNull(reply.getData());
}
Also used : Reply(io.rx_cache2.Reply) TestObserver(io.reactivex.observers.TestObserver) BaseTest(io.rx_cache2.internal.common.BaseTest) Test(org.junit.Test)

Aggregations

Reply (io.rx_cache2.Reply)16 Function (io.reactivex.functions.Function)9 FavoriteException (com.dante.exception.FavoriteException)7 MessageException (com.dante.exception.MessageException)7 EvictDynamicKey (io.rx_cache2.EvictDynamicKey)7 Test (org.junit.Test)7 BaseResult (com.dante.data.model.BaseResult)6 DynamicKeyGroup (io.rx_cache2.DynamicKeyGroup)6 EvictDynamicKeyGroup (io.rx_cache2.EvictDynamicKeyGroup)6 UnLimit91PornItem (com.dante.data.model.UnLimit91PornItem)4 TypeToken (com.google.gson.reflect.TypeToken)3 TestObserver (io.reactivex.observers.TestObserver)3 DynamicKey (io.rx_cache2.DynamicKey)3 BaseTest (io.rx_cache2.internal.common.BaseTest)3 Type (java.lang.reflect.Type)3 Reply (com.github.jh3nd3rs0n.jargyle.transport.socks5.Reply)2 Socks5Reply (com.github.jh3nd3rs0n.jargyle.transport.socks5.Socks5Reply)2 MeiZiTu (com.dante.data.model.MeiZiTu)1 Mm99 (com.dante.data.model.Mm99)1 PigAvVideo (com.dante.data.model.PigAvVideo)1