@AfterClass public static void stopServer() throws IOException { if (null != socketConnection) { socketConnection.close(); } }
@Override public void stop() throws IOException { socketConnection.close(); }
bos.write(bs); din.close(); hc.close(); response = bos.toString();
... SocketConnection client = (SocketConnection) Connector.open("socket://" + hostname + ":" + port); // set application-specific options on the socket. Call setSocketOption to set other options client.setSocketOption(DELAY, 0); client.setSocketOption(KEEPALIVE, 0); InputStream is = client.openInputStream(); OutputStream os = client.openOutputStream(); // send something to server os.write("some string".getBytes()); // read server response int c = 0; while((c = is.read()) != -1) { // do something with the response } // close streams and connection is.close(); os.close(); client.close(); ...
connection.close(); final_OP(new String(baos.toByteArray()) ); } catch (IOException ex) {