Copyright (c) 2012, iSEC Partners.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the ...
If you think the Android project android-ssl-bypass listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.isecpartners.android.jdwp.connection;
/*www.java2s.com*/import java.util.Map;
import com.sun.jdi.connect.AttachingConnector;
import com.sun.jdi.connect.Connector;
publicclass DefaultConnectionFactory {
// TODO not implemented
public AbstractConnection createListening(String transport, String host,
String address) throws NoListeningConnectorException {
return null;
}
public AbstractConnection createSocket(String hostname, String port)
throws NoAttachingConnectorException {
AttachingConnector connector = DVMConnectionProvider
.getAttachingConnector("dt_socket");
if (connector == null) {
thrownew NoAttachingConnectorException("no socket connectors");
}
// Set the connector arguments.
Map<String, ? extends Connector.Argument> args = connector
.defaultArguments();
if ((hostname != null) && (hostname.length() > 0)) {
args.get("hostname").setValue(hostname);
}
args.get("port").setValue(port);
// Create the actual connection.
return this.setTimeout(connector, args);
}
private AbstractConnection setTimeout(Connector connector,
Map<String, ? extends Connector.Argument> args) {
int timeout = 3000;
args.get("timeout").setValue(String.valueOf(timeout));
// Create the actual connection.
returnnew AttachingConnection(connector, args);
}
}