/**
* Connect the connection to the server.
* @throws IOException if an I/O error occurs when connecting
*/
void connect() throws IOException {
LOGGER.log(Level.FINE, "Connecting to {0}:{1,number,#####} ...",
new Object[]{serviceUrl.getHost(), serviceUrl.getPort()});
socket = socketFactory.createSocket(serviceUrl);
socket.setSoTimeout(0);
// The socket InputStream and OutputStream are not closed directly. They
// are shutdown and closed via method calls on the socket itself.
output = new MessageOutputStream(socket.getOutputStream());
LOGGER.log(Level.FINE, "Starting receiver");
clientListener = new ClientListener(new MessageInputStream(socket.getInputStream()), requestTimeout);
clientListenerThread = new Thread(clientListener, "jmx-client-receiver");
clientListenerThread.start();
LOGGER.log(Level.FINE, "Sending logon request");
final RequestLogon logon = new RequestLogon(credentials);
LOGGER.log(Level.FINE, "Handling logon response");
final Response logonResponse = handleRequest(logon);
if (logonResponse.getException() != null) {
LOGGER.log(Level.FINE, "Logon failed");
throw new IOException("Could not logon", logonResponse.getException());
}
connectionId = (String) logonResponse.getResult();
LOGGER.log(Level.FINE, "Connected; connectionId = {0}", connectionId);
connector.sendConnectionNotification(JMXConnectionNotification.OPENED, connectionId);
}
ClientConnection.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:OperatieBRP
作者:
评论列表
文章目录