* @param cmd
* the command to send
* @return the response.
*/
private DBGpResponse sendcmd(String cmd) {
DBGpResponse dbgpResp = null;
try {
// TODO: look at reducing the timeout for connection failure.
// Socket s = new Socket(proxyHost, proxyPort);
Socket s = new Socket();
InetSocketAddress server = new InetSocketAddress(proxyHost,
proxyPort);
InetSocketAddress local = new InetSocketAddress(0);
s.bind(local);
s.connect(server, PROXY_CONNECT_TIMEOUT);
InputStream is = s.getInputStream();
OutputStream os = s.getOutputStream();
if (DBGpLogger.debugCmd()) {
DBGpLogger.debug("cmd: " + cmd); //$NON-NLS-1$
}
os.write(cmd.getBytes("ASCII")); //command will always be ASCII //$NON-NLS-1$
os.flush();
byte[] resp = readResponse(is);
dbgpResp = new DBGpResponse();
dbgpResp.parseResponse(resp);
s.shutdownInput();
s.shutdownOutput();
s.close();
return dbgpResp;
} catch (IOException ioe) {