Package org.ryant.tubesock.api.stream

Examples of org.ryant.tubesock.api.stream.RemoteStreamReference


    @Test
    public void testCreateRemoteStream() throws Exception
    {
        ByteArrayInputStream input = new ByteArrayInputStream(TEST_STRING.getBytes());
        RemoteStreamReference details = manager.createRemoteStream(input);

        InputStream is = RemoteStreamClientFactory.getRemoteStreamClient(details).getInputStream();
        String result = InputStreamUtil.toString(is);
        TestCase.assertEquals(TEST_STRING, result);
    }
View Full Code Here


    @Test
    public void testConnectionRejectedOnBadHash() throws Exception
    {
        ByteArrayInputStream input = new ByteArrayInputStream(TEST_STRING.getBytes());
        RemoteStreamReference details = manager.createRemoteStream(input);
        RemoteStreamReference badDetails = new CoreRemoteStreamReference(details.getHost(), details.getPort(), details.getHash().replaceAll("-", "+"), details.getExpiry());

        try
        {
            InputStream is = RemoteStreamClientFactory.getRemoteStreamClient(badDetails).getInputStream();
        }
View Full Code Here

    @Test
    public void testHashIsEvictedAfterTTL() throws Exception
    {
        ByteArrayInputStream input = new ByteArrayInputStream(TEST_STRING.getBytes());
        // Expires immediately
        RemoteStreamReference details = manager.createRemoteStream(input, 1, TimeUnit.MILLISECONDS);
        // Ensure we are passed the TTL
        Thread.sleep(100);

        try
        {
View Full Code Here

        List<RemoteStreamReference> details = new ArrayList<RemoteStreamReference>();
        for (int i = 0; i < 20; i++)
        {
            String testString = UUID.randomUUID().toString() + UUID.randomUUID().toString() + UUID.randomUUID().toString();
            ByteArrayInputStream input = new ByteArrayInputStream(testString.getBytes());
            RemoteStreamReference reference = manager.createRemoteStream(input);
            details.add(reference);
            testInputs.put(reference.getHash(), testString);
        }
        Thread.sleep(1000);
        for (RemoteStreamReference detail : details)
        {
            InputStream is = RemoteStreamClientFactory.getRemoteStreamClient(detail).getInputStream();
View Full Code Here

TOP

Related Classes of org.ryant.tubesock.api.stream.RemoteStreamReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.