@Override public void run() { StreamHost streamHost = new StreamHost(proxyJID, serverAddress, serverPort); Socks5Client socks5Client = new Socks5Client(streamHost, digest); try { socks5Client.getSocket(10000); fail("exception should be thrown"); } catch (SmackException e) { assertTrue(e.getMessage().contains( "Unsupported SOCKS5 address type")); } catch (Exception e) { fail(e.getMessage()); } }
@Override public void run() { StreamHost streamHost = new StreamHost(proxyJID, serverAddress, serverPort); Socks5Client socks5Client = new Socks5Client(streamHost, digest); try { socks5Client.getSocket(10000); fail("exception should be thrown"); } catch (SmackException e) { assertTrue(e.getMessage().contains( "SOCKS5 negotiation failed")); } catch (Exception e) { fail(e.getMessage()); } }
@Override public void run() { StreamHost streamHost = new StreamHost(proxyJID, serverAddress, serverPort); Socks5Client socks5Client = new Socks5Client(streamHost, digest); try { socks5Client.getSocket(10000); fail("exception should be thrown"); } catch (SmackException e) { assertTrue(e.getMessage().contains( "SOCKS5 negotiation failed")); } catch (Exception e) { fail(e.getMessage()); } }
assertTrue(e.getMessage().contains("no SOCKS5 proxies available"));
assertTrue(e.getMessage().contains("no SOCKS5 proxies available")); assertTrue(e.getMessage().contains("no SOCKS5 proxies available"));
assertTrue(e.getMessage().contains("no SOCKS5 proxies available"));
/** * If the target is not connected to the local SOCKS5 proxy an exception should be thrown. * * @throws Exception should not happen */ @Test public void shouldFailIfTargetIsNotConnectedToLocalSocks5Proxy() throws Exception { // start a local SOCKS5 proxy Socks5Proxy.setLocalSocks5ProxyPort(proxyPort); Socks5Proxy socks5Proxy = Socks5Proxy.getSocks5Proxy(); socks5Proxy.start(); // build stream host information for local SOCKS5 proxy StreamHost streamHost = new StreamHost(connection.getUser(), loopbackAddress, socks5Proxy.getPort()); // create digest to get the socket opened by target String digest = Socks5Utils.createDigest(sessionID, initiatorJID, targetJID); Socks5ClientForInitiator socks5Client = new Socks5ClientForInitiator(streamHost, digest, connection, sessionID, targetJID); try { socks5Client.getSocket(GET_SOCKET_TIMEOUT); fail("exception should be thrown"); } catch (SmackException e) { assertTrue(e.getMessage().contains("target is not connected to SOCKS5 proxy")); protocol.verifyAll(); // assert no XMPP messages were sent } socks5Proxy.stop(); }
assertTrue(e.getMessage().contains("Remote user responded with unknown host"));
try { connection.connect(); } catch (SmackException e) { Log.i("SmackException ", "ConnectionException: " + e.getMessage()); List<HostAddress> hostAddresses = ((SmackException.ConnectionException) e).getFailedAddresses(); if (!hostAddresses.isEmpty()) { Log.i("SmackException: HostAddress: ", hostAddresses.get(0).toString()); Log.i("SmackException: HostAddress: ", hostAddresses.get(0).getException().toString()); }