Examples of MyHttpURLConnection


Examples of com.pugh.sockso.tests.MyHttpURLConnection

        v.fireLatestVersionEvent( "1.2.1" );
        assertTrue( l.gotEvent );
    }

    public void testVersionFetchedCorrectlyFromUrlConnection() {
        MyHttpURLConnection cnn = new MyHttpURLConnection( "1.2.1" );
        VersionChecker v = new VersionChecker( p );
        VersionCheckerTestListener l = new VersionCheckerTestListener();
        v.addLatestVersionListener( l );
        v.fetchLatestVersionFrom( cnn );
        assertEquals( l.version, "1.2.1" );
View Full Code Here

Examples of com.pugh.sockso.tests.MyHttpURLConnection

        v.fetchLatestVersionFrom( cnn );
        assertEquals( l.version, "1.2.1" );
    }

    public void testFetchingATwoPartVersionNumber() {
        MyHttpURLConnection cnn = new MyHttpURLConnection( "1.2" );
        VersionChecker v = new VersionChecker( p );
        VersionCheckerTestListener l = new VersionCheckerTestListener();
        v.addLatestVersionListener( l );
        v.fetchLatestVersionFrom( cnn );
        assertEquals( l.version, "1.2" );
View Full Code Here

Examples of com.pugh.sockso.tests.MyHttpURLConnection

        assertEquals( l.version, "1.2" );
    }

    public void testNothingFetchedWhenVersionCheckingDisabled() {
        p.set( Constants.VERSION_CHECK_DISABLED, p.YES );
        MyHttpURLConnection cnn = new MyHttpURLConnection( "1.2" );
        VersionChecker v = new VersionChecker( p );
        VersionCheckerTestListener l = new VersionCheckerTestListener();
        v.addLatestVersionListener( l );
        v.fetchLatestVersionFrom( cnn );
        assertEquals( l.version, "" );
View Full Code Here

Examples of com.pugh.sockso.tests.MyHttpURLConnection

    }

    @Override
    protected HttpURLConnection getUrlConnection( final String url ) {
        if ( urlCnn == null ) {
            urlCnn = new MyHttpURLConnection( "ok" );
        }
        return urlCnn;
    }
View Full Code Here

Examples of com.pugh.sockso.tests.MyHttpURLConnection

        // first try a failed connection

        boolean gotException = false;

        try {
            final HttpURLConnection cnn = new MyHttpURLConnection( null );
            f.getIpFromUrl( cnn );
        }
        catch ( final IOException e ) {
            gotException = true;
        }

        assertTrue( gotException );

        // now try a good connection

        final String ip = "192.168.1.2";

        gotException = false;

        try {

            final HttpURLConnection cnn = new MyHttpURLConnection( ip );
            final String gotIp = f.getIpFromUrl( cnn );

            assertEquals( ip, gotIp );

        }
View Full Code Here

Examples of com.pugh.sockso.tests.MyHttpURLConnection

        final String origCover = "http://ecx.images-amazon.com/images/I/41YZSP49YBL._SL160_AA115_.jpg";
        final String data = "da khsdk jahdjk hkjas dkj" +
                            "           junk <img src=\"" +origCover+ "\" more crap\n" +
                            " blah blah";
        final MyHttpURLConnection cnn = new MyHttpURLConnection( data );
        final AmazonCoverSearch s = new AmazonCoverSearch( null );
        final String fetchedCover = s.getCoverFromSearchResults( cnn );

        assertEquals( origCover, fetchedCover );
View Full Code Here

Examples of com.pugh.sockso.tests.MyHttpURLConnection

        for ( String origCover : paths ) {
               
            final String data = "da khsdk jahdjk hkjas dkj" +
                                "           junk <img src=\"" +origCover+ "\" more crap\n" +
                                " blah blah";
            final MyHttpURLConnection cnn = new MyHttpURLConnection( data );
            final AmazonCoverSearch s = new AmazonCoverSearch( null );
            final String fetchedCover = s.getCoverFromSearchResults( cnn );

            assertEquals( origCover, fetchedCover );
       
View Full Code Here

Examples of com.pugh.sockso.tests.MyHttpURLConnection

    public void testGetCoverFromSearchResultsNoResults() throws IOException {

        final AmazonCoverSearch s = new AmazonCoverSearch( null );
        final String data = "";
        final MyHttpURLConnection cnn = new MyHttpURLConnection( data );
        final String cover = s.getCoverFromSearchResults( cnn );

        assertNull( cover );

    }
View Full Code Here

Examples of com.pugh.sockso.tests.MyHttpURLConnection

    public void setUrlResponse( String data ) {
        this.data = data;
    }

    protected HttpURLConnection getHttpURLConnection( String url ) {
        return new MyHttpURLConnection( data );
    }
View Full Code Here

Examples of com.pugh.sockso.tests.MyHttpURLConnection

    public void setUrlResponse( String data ) {
        this.data = data;
    }

    protected HttpURLConnection getHttpURLConnection( String url ) {
        return new MyHttpURLConnection( data );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.